-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
46 lines (35 loc) · 908 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
const express = require('express');
const app = express();
const port = process.env.PORT || 9000;
const hbs = require('hbs');
app.disable('x-powered-by');
app.use((req, res, next) => {
res.setHeader('x-powered-by', 'ffconf');
next();
});
hbs.registerPartials(__dirname + '/views/partials');
// data
const data = {
details: '',
speakers: '',
terms: 'Terms and Conditions - ',
};
app.set('views', __dirname + '/views');
app.set('view engine' ,'hbs');
Object.keys(data).forEach(name => {
app.get(`/${name}`, (req, res) => res.render(name, { title: data[name], name }));
});
app.get('/', (req, res) => {
res.render('speakers', {
name: 'speakers',
title: '',
});
});
app.use(express.static(__dirname, + '/public'));
if (module.parent) {
module.exports = app;
} else {
app.listen(port, () => {
console.log(`Express server listening on http://localhost:${port}`);
});
}