-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.js
33 lines (25 loc) · 991 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
30
31
32
33
var friend = require('port-friends'),
express = require('express'),
path = require('path'),
favicon = require('serve-favicon');
var subscribe = require('./routes/subscribe');
var app = express();
app.set('port', process.env.PORT || 80);
app.use(favicon(path.join(__dirname, 'public', 'img', 'favicon.ico')));
app.use('/static', express.static(path.join(__dirname, 'dist')));
app.get('/', function(req, res) {
res.status(200).sendFile(path.join(__dirname, 'dist', 'pages', 'index.html'));
});
app.get('/sponsor.pdf', function(req, res) {
res.status(200).sendFile(path.join(__dirname, 'dist', 'files', 'sponsor.pdf'));
});
app.get('/conduct', function(req, res) {
res.status(200).sendFile(path.join(__dirname, 'dist', 'pages', 'conduct.html'));
});
app.get('/*', function(req, res) {
res.status(200).sendFile(path.join(__dirname, 'dist', 'pages', '404.html'));
});
app.listen(app.get('port'), friend({
myport: app.get('port'),
mode: app.get('env')
}));