-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
30 lines (23 loc) · 851 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
const express = require("express"),
app = express(),
cors = require("cors"),
bodyParser = require("body-parser"),
mongoose = require("mongoose"),
middleware = require("./middlwares/index");
require("dotenv").config();
//ROUTES
const indexRoute = require("./routes/index"),
noteRoute = require("./routes/note");
mongoose.connect(process.env.DATABASEURL,{ useUnifiedTopology: true ,useNewUrlParser:true});
mongoose.set("useFindAndModify",false);
mongoose.set("useCreateIndex",true);
app.use(cors());
app.use(bodyParser.urlencoded({extended:true}));
app.use(bodyParser.json());
middleware(app);
app.use("/",indexRoute);
// app.use("/note",noteRoute);
app.listen(5000)
{
console.log("Server has started");
}