-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
39 lines (30 loc) · 928 Bytes
/
server.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
36
37
38
39
var flatiron = require('flatiron'),
path = require('path'),
routes = require('./lib/plugins/routes'),
connect = require('connect'),
expressUglify = require('express-uglify'),
pkg = require('./package.json'),
app = flatiron.app;
app.config.file({ file: path.join(__dirname, 'config', 'config.json') });
var port = app.config.get('port');
app.use(flatiron.plugins.http, {
before: [
connect.static(__dirname + '/public', {maxAge: 86400000}),
connect.staticCache()
],
after: [],
onError: function(err) {
if(err) {
this.res.writeHead(404, { "Content-Type": "text/html" });
this.res.end('404');
}
}
});
app.use(routes);
app.start(port,
function(err) {
if(err) throw err;
require('mca')(app.log, {
port: port
});
});