-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
36 lines (26 loc) · 912 Bytes
/
app.js
File metadata and controls
36 lines (26 loc) · 912 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
28
29
30
31
32
33
34
35
36
const express = require('express')
const app = express()
const cors = require('cors')
const dotenv = require('dotenv')
dotenv.config()
const mongoose = require('mongoose')
const bodyParsr = require('body-parser')
const UserRouter = require('./UserRouter')
app.get('/',(req,res)=>{res.send('Hello world!!')});
app.use(cors())
app.use(bodyParsr.json())
app.use('/users', UserRouter)
// const connectionParams = {
// useNewUrlParser: true,
// useCreateIndex: true,
// useUnifiedTopology: true,
// useFindAndModify: false
// }
// mongoose.connect("mongodb://localhost:27017/ProjectData", connectionParams)
// .then(() => {
// console.log('connected to db')
// }).catch(err => {
// console.log(err)
// })
// app.listen(process.env.PORT, () => { console.log(`listening port ${process.env.PORT}`) })
app.listen(5005, () => { console.log(`listening port ${5005}`) })