-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrequestHandlers.js
48 lines (44 loc) · 1.55 KB
/
requestHandlers.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
var logListHelper = require('./logListHelper');
var loglist = logListHelper.buildLogList();
var fortunesHelper = require('./fortunesHelper');
var fortunes = fortunesHelper.generateFortunes()
var getRandomFortune = fortunesHelper.getRandomFortune
var photosHelper = require('./photosHelper');
var albums = photosHelper.buildAlbumList();
var radioListHelper = require('./radioListHelper');
var radiolist = radioListHelper.buildRadioList();
function renderRadio(req, res)
{
res.render('radio', { layout: 'index', radiolist: radiolist, fortune: getRandomFortune(fortunes) });
}
function renderLogList(req, res)
{
res.render('log', { layout: 'index', logs: loglist, fortune: getRandomFortune(fortunes) });
}
function renderLog(req, res)
{
res.render('singleLog', { layout: 'index', log: logListHelper.getOneLog(req, loglist), fortune: getRandomFortune(fortunes) });
}
function renderHome(req, res)
{
res.render('home', { layout: 'index', fortune: getRandomFortune(fortunes) });
}
function renderWorks(req, res)
{
res.render('works', { layout: 'index', fortune: getRandomFortune(fortunes) });
}
function renderPhotos(req, res)
{
res.render('photos', { layout: 'index', albums: albums, fortune: getRandomFortune(fortunes) });
}
function render404(req, res)
{
res.render('404', { layout: "index", fortune: getRandomFortune(fortunes) });
}
exports.renderHome = renderHome;
exports.renderLog = renderLog;
exports.renderWorks = renderWorks;
exports.renderLogList = renderLogList;
exports.renderRadio = renderRadio;
exports.render404 = render404;
exports.renderPhotos = renderPhotos;