-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathserver.js
More file actions
57 lines (48 loc) · 1.55 KB
/
Copy pathserver.js
File metadata and controls
57 lines (48 loc) · 1.55 KB
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
50
51
52
53
54
55
56
57
'use strict';
const path = require('path');
const hof = require('hof');
const config = require('./config');
let settings = require('./hof.settings');
settings = Object.assign({}, settings, {
behaviours: settings.behaviours.map(require),
routes: settings.routes.map(require),
views: settings.views.map(view => path.resolve(__dirname, view)),
getTerms: false,
getCookies: false,
csp: {
imgSrc: [
'www.google-analytics.com',
'ssl.gstatic.com',
'www.google.co.uk/ads/ga-audiences'
],
connectSrc: [
'https://www.google-analytics.com',
'https://region1.google-analytics.com',
'https://region1.analytics.google.com'
]
}
});
const app = hof(settings);
// Terms & Cookies added to have visibility on accessibility statement
// in the footer. Once HOF has updated with that we can remove these
// including the getTerms: false, getCookies: false config
app.use('/terms-and-conditions', (req, res, next) => {
res.locals = Object.assign({}, res.locals, req.translate('terms'));
next();
});
app.use('/cookies', (req, res, next) => {
res.locals = Object.assign({}, res.locals, req.translate('cookies'));
next();
});
app.use((req, res, next) => {
res.locals.htmlLang = 'en';
res.locals.footerSupportLinks = [
{ path: '/cookies', property: 'base.cookies' },
{ path: '/terms-and-conditions', property: 'base.terms' },
{ path: '/accessibility', property: 'base.accessibility' }
];
res.locals.feedbackUrl = config.feedbackUrl;
next();
});
app.use(require('./redirects.js')());
module.exports = app;