-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
32 lines (26 loc) · 878 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
const express = require('express');
const app = express();
const mongoose = require('mongoose');
const multer = require('multer');
const cors = require('cors');
const authRoutes = require('./Routes/authRoutes')
const userRoutes = require('./Routes/userRoutes')
const docRoutes = require('./Routes/docRoutes')
const commentRoutes = require('./Routes/commentRoutes')
require('dotenv').config();
app.use(express.json());
app.use(cors())
app.use("/auth",authRoutes)
app.use("/users",userRoutes)
app.use("/doc",docRoutes)
app.use("/comments",commentRoutes)
mongoose.connect(process.env.MONGO_URI,{useNewUrlParser: true, useUnifiedTopology: true})
.then(()=>{
console.log(process.env.MONGO_URI)
console.log("DB connection successful")
}).catch((err)=> {
console.log(err)
});
app.listen( process.env.PORT ||5000, () =>{
console.log("Server is running")
})