-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
48 lines (40 loc) · 973 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const express = require('express'),
express_hb = require('express-handlebars'),
app = express();
app.engine('hbs', express_hb.engine({
extname: ".hbs",
helpers: {
// json: function (context) {
// return JSON.stringify(context);
// }
section(name, options) {
if (!this._sections)
this._sections = {};
this._sections[name] = options.fn(this);
return null;
},
},
layoutsDir: __dirname + '/views/layouts',
}));
app.set('view engine', 'hbs');
app.set('views', './views');
app.use(express.static('public'));
//
app.get('/projects', function (req, res) {
res.render('projects');
});
// hi dpi screens
app.get('/hires', function (req, res) {
res.render('hires');
});
// index
app.get('/', function (req, res) {
res.render('index');
});
app.get('*', function (req, res) {
res.status(404).render('notfound');
});
const port = Number(process.env.PORT || 5000);
app.listen(port, function () {
console.log("Listening on port " + port);
});