-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserver.js
38 lines (29 loc) · 1.16 KB
/
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
require('marko/express');
require('marko/node-require');
var express = require('express');
var compression = require('compression'); // Provides gzip compression for the HTTP response
var serveStatic = require('serve-static');
// If the process was started using browser-refresh then enable
// hot reloading for certain types of files to short-circuit
// a full process restart. You *should* use browser-refresh
// in development: https://www.npmjs.com/package/browser-refresh
require('marko/browser-refresh').enable();
var app = express();
var port = process.env.PORT || 8080;
// Enable gzip compression for all HTTP responses
app.use(compression());
// Allow all of the generated files under "static" to be served up by Express
app.use('/static', serveStatic(__dirname + '/static'));
// Map the "/" route to the home page
app.get('/', require('./routes/index'));
app.listen(port, function(err) {
if (err) {
throw err;
}
console.log('Listening on port %d', port);
// The browser-refresh module uses this event to know that the
// process is ready to serve traffic after the restart
if (process.send) {
process.send('online');
}
});