-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
28 lines (27 loc) · 876 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
const express = require('express');
const http=require('http')
const mongoose=require('mongoose');
const authRouter = require('./server/routes/auth');
const userRouter = require('./server/routes/user_router');
const adminRouter = require('./server/routes/admin_router');
const productRouter = require('./server/routes/product_router');
const DB='mongodb+srv://xxxxxxxx@cluster0.wgtypza.mongodb.net/?retryWrites=true&w=majority';
console.log("subhash");
const app = express();
const PORT=3000;
app.set("connection", "close");
app.use(express.json());
app.use(authRouter);
app.use(userRouter);
app.use(adminRouter);
app.use(productRouter);
app.listen(PORT,()=>{
console.log('connection is successful');
})
mongoose.connect(DB).then( ()=>{
console.log('connected to mongoDB');
}
).catch((e)=>{
console.log('not connected to mongoDB');
console.log(e);
});