-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
26 lines (21 loc) · 727 Bytes
/
app.js
File metadata and controls
26 lines (21 loc) · 727 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
/**
* serve the static files up with express
*/
var express = require('express'),
http = require('http'),
path = require('path'),
app = express();
function clientErrorHandler(err, req, res, next) {
if (req.xhr) res.send(500, { error: 'Something blew up!' });
else ext(err);
}
app.set('port', 3030);
app.use(clientErrorHandler);
app.use(express.favicon());
app.use(express.bodyParser());
app.use(express.logger('dev'));
app.use('/app', express.static(__dirname + '/app'));
app.get('*', function (req, res) { res.sendfile(path.join(__dirname, 'app/index.html')); });
http.createServer(app).listen(app.get('port'), function(){
console.log('Express server listening on port ' + app.get('port'));
});