-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
34 lines (27 loc) · 828 Bytes
/
server.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
// @ts-ignore
const express = require("express")
const morgan = require("morgan")
const colors = require("colors")
const dotenv = require("dotenv");
const connectDB = require("./config/db");
//configuring dotenv file
dotenv.config();
//mongodb connection
connectDB();
//creating instance of express
const app = express();
//middlewares
app.use(express.json()) //parsing json data in the request body
app.use(morgan("dev")) // detail information about incoming requests
//routes
app.use("/api/v1/user", require("./routes/userRoutes"));
app.use('/api/v1/admin', require("./routes/adminRoutes"));
app.use('/api/v1/doctor', require('./routes/doctorRoutes'));
//port
const port = process.env.PORT || 5000
//Listening to port
app.listen(port, ()=>{
console.log(
`Server Running on port ${process.env.PORT}`
)
})