mirror of
https://github.com/Alvin-Zilverstand/challenge-11.git
synced 2026-03-06 02:56:27 +01:00
Remove index.html, styles.css, favicon.svg, script.js, and tailwind.config.js files to streamline the project and eliminate unused resources.
This commit is contained in:
28
server.js
Normal file
28
server.js
Normal file
@@ -0,0 +1,28 @@
|
||||
const express = require('express');
|
||||
const mongoose = require('mongoose');
|
||||
const cors = require('cors');
|
||||
const dotenv = require('dotenv');
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const app = express();
|
||||
|
||||
// Middleware
|
||||
app.use(cors());
|
||||
app.use(express.json());
|
||||
|
||||
// MongoDB Connection
|
||||
mongoose.connect(process.env.MONGODB_URI || 'mongodb://localhost:27017/car-tuning-crm', {
|
||||
useNewUrlParser: true,
|
||||
useUnifiedTopology: true
|
||||
})
|
||||
.then(() => console.log('MongoDB connected'))
|
||||
.catch(err => console.log('MongoDB connection error:', err));
|
||||
|
||||
// Routes
|
||||
app.use('/api/auth', require('./routes/auth'));
|
||||
app.use('/api/customers', require('./routes/customers'));
|
||||
app.use('/api/contacts', require('./routes/contacts'));
|
||||
|
||||
const PORT = process.env.PORT || 5000;
|
||||
app.listen(PORT, () => console.log(`Server running on port ${PORT}`));
|
||||
Reference in New Issue
Block a user