-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
25 lines (20 loc) · 708 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
const express = require('express');
const app = express();
const dotenv = require('dotenv');
const mongoose = require('mongoose');
// Import Routes
const docRoute = require('./routes/doctors');
const patientRoute = require('./routes/patients');
const reportRoute = require('./routes/reports')
dotenv.config();
// Connect to DB
mongoose.connect(process.env.DB_CONNECT, { useNewUrlParser: true, useUnifiedTopology: true },
() => console.log("Successfully connected to DB!")
);
// Middlewares
app.use(express.json());
// Route Middlewares
app.use('/doctors', docRoute);
app.use('/patients', patientRoute);
app.use('/reports', reportRoute);
app.listen(3000, () => console.log('Server up and running'));