-
Notifications
You must be signed in to change notification settings - Fork 7
/
app.js
58 lines (43 loc) · 1.34 KB
/
app.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
50
51
52
53
54
55
56
57
58
require('logger').startAppInsights();
const config = require('config');
const express = require('express');
const events = require('events');
const commonContent = require('commonContent.json');
const url = require('url');
const healthcheck = require('services/healthcheck');
const {
configureNunjucks,
configureMiddleWares,
configureViews,
configureHelmet,
configureJourney,
configureAppRoutes,
configureGlobalVariables
} = require('./appConfigurations');
const app = express();
const port = config.get('node.port');
// Tests
const PORT_RANGE = 50;
app.set('portFrom', port);
app.set('portTo', port + PORT_RANGE);
app.set('assetPath', url.resolve('/', 'assets/'));
app.set('trust proxy', true);
app.locals.asset_path = url.resolve('/', 'assets/');
events.EventEmitter.defaultMaxListeners = 500000;
// Configure App health.
healthcheck.setup(app);
// Configure App routes.
configureAppRoutes(app);
// Configure App Middlewares
configureMiddleWares(app, express);
// Configure Helmet Security Policies.
configureHelmet(app);
// Configure View Locations
configureViews(app);
// Configure Nunjucks Settings
const njk = configureNunjucks(app, commonContent);
// Configure App Middleware Global Variable setting
configureGlobalVariables(app, njk);
// Configure One Per page settings.
configureJourney(app, commonContent);
module.exports = app;