-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
31 lines (24 loc) · 944 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
31
const express = require("express"),
app = express(),
cors = require("cors"),
bodyParser = require("body-parser"),
mongoose = require("mongoose"),
middleware = require("./middlewares/index");
require("dotenv").config();
//ROUTES
const indexRoute = require("./routes/index");
const chartRoute = require("./routes/chart");
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());
app.use('/us-east-2.elasticbeanstalk.com', express.static('us-east-2.elasticbeanstalk.com'));
middleware(app);
app.use("/",indexRoute);
app.use("/chart",chartRoute);
app.listen(process.env.PORT)
{
console.log("Server has started");
}