-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
32 lines (29 loc) · 868 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
//Libraries
var express = require("express"),
app = express(),
bodyParser = require("body-parser");
//APP
app.set("view engine", "ejs");
app.use(bodyParser.urlencoded({ extended: true }));
//Semantic-ui
app.use(express.static(__dirname + "/semantic/dist"));
//Public assets
app.use(express.static(__dirname + "/public"));
//Global middleware
app.use(function (req, res, next) {
res.locals.errorCallback = function (err) {
console.log("ERROR: " + err); //TO BE REFACTORED
};
return next(); //It's a must
});
//Routes
var indexRoute = require("./routes/index"),
busRoute = require("./routes/bus");
app.use("/bus", busRoute);// "/bus", prefix
app.use(indexRoute);
//Web server
var ip = process.env.IP || "0.0.0.0",
port = process.env.PORT || 8000;
app.listen(port, ip, function () {
console.log("GetMeABus have started...");
});