-
Notifications
You must be signed in to change notification settings - Fork 6
/
server.js
45 lines (39 loc) · 1.15 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
39
40
41
42
43
44
45
var restify = require('restify'),
serverOpts = {},
fs = require('fs');
if (process.env.KEY) {
serverOpts.key = fs.readFileSync(process.env.KEY);
serverOpts.certificate = fs.readFileSync(process.env.CERTIFICATE);
}
var server = restify.createServer(serverOpts);
server.use(restify.queryParser());
// serve static JavaScript and CSS.
server.get(/\/js|css|images\/?.*/, restify.serveStatic({
directory: './assets'
}));
// past events.
server.get(/\/2014\/10\/04\/?/, restify.serveStatic({
directory: './assets',
default: 'index.html'
}));
server.get(/\/2014\/12\/13\/?/, restify.serveStatic({
directory: './assets',
default: 'index.html'
}));
server.get(/\/2015\/03\/28\/?/, restify.serveStatic({
directory: './assets',
default: 'index.html'
}));
server.get(/\/2015\/09\/25\/?/, restify.serveStatic({
directory: './assets',
default: 'index.html'
}));
// serve the static index page.
server.get(/\/?/, restify.serveStatic({
directory: './assets',
default: 'index.html'
}));
// bind server to on port 5000, or the port provided.
server.listen(process.env.PORT || 5000, function () {
console.log('%s listening at %s', server.name, server.url);
});