-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
35 lines (28 loc) · 879 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
var express = require("express");
// var bodyParser = require("body-parser");
var errorHandler = require("errorhandler");
var app = express();
var root = __dirname + "/public";
// --------------------------------------------------------------------
// SET UP EXPRESS
// --------------------------------------------------------------------
// Parse application/json and application/x-www-form-urlencoded
// app.use(bodyParser.urlencoded({
// extended: true
// }));
// app.use(bodyParser.json());
// Simple logger
app.use(function(req, res, next){
console.log("%s %s", req.method, req.url);
next();
});
// Error handler
app.use(errorHandler({
dumpExceptions: true,
showStack: true
}));
// Serve static files from directory
app.use(express.static(root));
// Open server on specified port
console.log("Starting Express server");
app.listen(process.env.PORT || 5002);