-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
38 lines (27 loc) · 957 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
32
33
34
35
36
37
38
var express = require("express");
var bodyParser = require("body-parser");
var morgan = require("morgan");
var mongoose = require("mongoose");
var cors = require("cors");
var config = require("./config");
var setupController = require("./api/controllers/setupController");
var todoController = require("./api/controllers/todoController");
var app = express();
var port = process.env.PORT || 3000;
app.use(cors());
app.use("/assets", express.static(__dirname + "/public"));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(morgan("dev"));
app.set("view engine", "ejs");
// db info
//console.log(config.getDbConnectionString());
mongoose.connect(config.getDbConnectionString());
setupController(app);
todoController(app);
app.get("/", function (req, res) {
res.render("index");
});
app.listen(port, function() {
console.log("App listening on port: " + port);
});