-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
36 lines (27 loc) · 947 Bytes
/
app.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
const cookieParser = require('cookie-parser')
const express = require('express');
const app = express();
var cors = require('cors')
app.use(express.json(), cors())
app.listen(5000)
app.use(express.urlencoded({extended: true}))
app.use(cookieParser())
require('dotenv').config()
let key = process.env.MONGO_KEY
const mongoose = require('mongoose');
const db_link = `mongodb+srv://admin:${key}@cluster0.1updrw4.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0`
mongoose.connect(db_link)
.then(function(db){
console.log('db connected');
})
.catch(function(err){
console.log(err);
})
const userRouter = require('./Routers/userRouter')
app.use('/user', userRouter)
const planRouter = require('./Routers/planRouter')
app.use('/plans', planRouter)
const reviewRouter = require('./Routers/reviewRouter')
app.use('/reviews', reviewRouter)
const bookingRouter = require('./Routers/bookingRouter')
app.use('/booking', bookingRouter)