-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
49 lines (41 loc) · 1.38 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
var http = require('http');
var path = require('path');
var express = require('express');
var app = express();
var options = { root: __dirname + "/"} ;
app.set('port', 8080);
app.set('case sensitive routing', false);
app.get('/', function(req, res) {
res.sendFile("Index.html", options, function (err) {
if (err) {
console.log(err);
res.send('Error - ', err.status);
}
});
});
app.get('/list/:slug', function(req, res) {
res.sendFile("checklistPage.html", options, function (err) {
if (err) {
console.log(err);
res.send('Error - ', err.status);
}
});
});
app.get('/other', function(req, res) {
res.sendFile("Other.html", options, function (err) {
if (err) {
console.log(err);
res.send('Error - ', err.status);
}
});
});
// Set Public Paths
app.use('/scripts', express.static(path.join(__dirname, '/_build/js')));
app.use('/styles', express.static(path.join(__dirname, '/_build/styles')));
app.use('/fonts', express.static(path.join(__dirname,'/_build/fonts')));
app.use('/images', express.static(path.join(__dirname, '/_build/images')));
app.use('/gfx', express.static(path.join(__dirname, '/_build/gfx')));
// Listen to Port
var server = app.listen(process.env.PORT || app.get('port'), function(){
console.log("Server started on port " + server.address().port);
});