-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
24 lines (21 loc) · 692 Bytes
/
app.js
File metadata and controls
24 lines (21 loc) · 692 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
const express = require('express');
const app = express();
const bodyParser = require('body-parser');
const mongoose = require('mongoose');
const user_routes = require('./routes/user');
require('dotenv').config();
mongoose.set('useCreateIndex', true);
mongoose.connect(
"mongodb://localhost:27017/next-pro",
{ useNewUrlParser: true, useUnifiedTopology: true},
err => {
if(err) throw err.message;
console.log('mongodb connection successfully');
},
);
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use('/api', user_routes);
app.listen(process.env.PORT , ()=> {
console.log('server started on', process.env.PORT);
})