-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
28 lines (23 loc) · 715 Bytes
/
Copy pathserver.js
File metadata and controls
28 lines (23 loc) · 715 Bytes
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
// to do local testing, move index back into the public directory
// and change all the relative paths
var express = require("express"),
app = express(),
bodyParser = require('body-parser')
errorHandler = require('errorhandler'),
methodOverride = require('method-override'),
port = parseInt(process.env.PORT, 10) || 4567;
app.get("/", function (req, res) {
res.redirect("/index.html");
});
app.use(methodOverride());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extended: true
}));
app.use(express.static(__dirname + '/public'));
app.use(errorHandler({
dumpExceptions: true,
showStack: true
}));
console.log("Listening at http://localhost:" + port);
app.listen(port);