forked from sorenlouv/fb-sleep-stats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
29 lines (23 loc) · 755 Bytes
/
index.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
var config = require('config');
var PORT = config.get('server.port');
var express = require('express');
var cookieParser = require('cookie-parser');
var path = require('path');
var app = express();
// Cookies
app.use(cookieParser());
// Router
var router = require('./src/server/routes');
app.use(router);
// Static assets
app.use('/public', express.static('public'));
app.get('/*', function(request, response) {
response.sendFile(path.resolve(__dirname, 'public', 'index.html'));
});
// Avoid crashing the node process by handling uncaught exceptions
process.on('uncaughtException', function(err) {
console.error('Uncaught exception:', err, err.stack);
});
// Start app
app.listen(PORT);
console.log('Running on http://localhost:' + PORT);