-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathserver.js
More file actions
28 lines (25 loc) · 694 Bytes
/
Copy pathserver.js
File metadata and controls
28 lines (25 loc) · 694 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
var connect = require('connect'),
api = require('./api'),
port = parseInt(process.env.PORT) || 8000;
var server = connect.createServer(
connect.logger(),
connect.errorHandler({ dumpExceptions: true, showStack: true })
);
// Serve static resources.
server.use("/",
connect.conditionalGet(),
connect.cache(),
connect.gzip(),
connect.staticProvider(__dirname + '/public')
);
// Serve the API responses.
server.use("/api",
connect.bodyDecoder(),
connect.cookieDecoder(),
connect.router(api.router)
);
server.listen(port);
console.log('Nodify server running at http://127.0.0.1:' + port);
process.addListener('uncaughtException', function (err) {
console.log(err.stack);
});