-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
37 lines (29 loc) · 949 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import express from 'express';
import dotenv from 'dotenv'
dotenv.config()
import './db/mongoose.js'
import cors from 'cors';
//route imports
import patientRoutes from './routes/patient/patient.js';
import doctorRoutes from './routes/doctor/doctor.js';
import appointmentRoutes from './routes/appointment/appointment.js';
const app = express();
const port = process.env.PORT || 8000; // You can change the port number as needed
// Middleware to handle CORS (Cross-Origin Resource Sharing)
app.use(cors());
// Middleware to parse JSON requests
app.use(express.json());
// Define a sample route
app.get('/', (req, res) => {
res.send('Hello, World!');
});
// Doctor Routes
//app.use('/doctor', doctorRoutes);
// Patient Routes
app.use('/patient', patientRoutes);
app.use('/doctor', doctorRoutes);
app.use('/appointment', appointmentRoutes);
// Start the server
app.listen(port, () => {
console.log(`Server is running on port ${port}`);
});