-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
27 lines (21 loc) · 875 Bytes
/
app.js
File metadata and controls
27 lines (21 loc) · 875 Bytes
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
const express = require('express');
const bodyParser = require('body-parser');
const mongoose = require('mongoose');
const app = express();
const PORT = 5000;
mongoose.set('strictQuery', false);
mongoose.connect(
`mongodb+srv://coolmohit256:Mohit1234@cluster0.l190idm.mongodb.net/?retryWrites=true&w=majority`
).then(()=>
app.listen( 5000,() => console.log(`Connection Sucessful and Server is running on http://localhost:${PORT} `))
)
.catch((err)=>console.log(error.message()));
app.use(bodyParser.json());
const def = require('./routes/default');
const prRoutes = require('./routes/pr_routes.js');
const varRoutes = require('./routes/var_routes.js');
const search= require('./routes/search.js')
app.use('/', def);
app.use('/products', prRoutes);
app.use('/products/:prId/var', varRoutes);
app.use('/search',search);