-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
33 lines (24 loc) · 914 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
33
const express = require('express');
require('dotenv').config();
const mongoose = require('mongoose');
const cors = require('cors');
const menuRoutes = require('./src/routes/menuRoute');
const orderRoute = require('./src/routes/orderRoute');
const resturantRoutes = require('./src/routes/resturantRouter');
const userRoute = require('./src/routes/userRoute');
const app = express();
const port = process.env.PORT;
app.use(express.urlencoded({extended:true}));
app.use(express.json());
app.use(cors());
mongoose.connect(`${process.env.MONGODB_URI}`, {
useNewUrlParser: true,
useUnifiedTopology: true,
useFindAndModify: false,
useCreateIndex: true
},()=> console.log('Connected To database'));
app.use('/api/restaurant',resturantRoutes)
app.use('/api/menu',menuRoutes)
app.use('/api/user',userRoute);
app.use('/api/order',orderRoute);
app.listen(port, () => console.log(`Listnening to port ${port}`))