@apolitical/server 2.1.0-beta.1 → 2.1.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apolitical/server",
|
|
3
|
-
"version": "2.1.0-beta.
|
|
3
|
+
"version": "2.1.0-beta.2",
|
|
4
4
|
"description": "Node.js module to encapsulate Apolitical's express server setup",
|
|
5
5
|
"author": "Apolitical Group Limited <engineering@apolitical.co>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"husky": "7.0.4",
|
|
53
53
|
"jest": "27.4.7",
|
|
54
54
|
"jest-junit": "13.0.0",
|
|
55
|
-
"lint-staged": "12.
|
|
55
|
+
"lint-staged": "12.3.0",
|
|
56
56
|
"mock-jwks": "1.0.1",
|
|
57
57
|
"nock": "13.2.2"
|
|
58
58
|
},
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
module.exports = ({ bodyParser: { json, urlencoded }, compression, cors, cookieParser, config, logger }) => {
|
|
3
|
+
module.exports = ({ bodyParser: { json, urlencoded }, compression, cors, cookieParser, prerender, config, logger }) => {
|
|
4
4
|
const { BODY_PARSER_OPTIONS, CORS_OPTIONS } = config.SERVER;
|
|
5
5
|
|
|
6
|
-
return function load(app, { corsOptions }) {
|
|
6
|
+
return function load(app, { corsOptions, prerenderToken }) {
|
|
7
7
|
const childLogger = logger.where(__filename, 'load');
|
|
8
8
|
childLogger.debug('Started');
|
|
9
9
|
// Load useful middlewares
|
|
@@ -12,6 +12,9 @@ module.exports = ({ bodyParser: { json, urlencoded }, compression, cors, cookieP
|
|
|
12
12
|
app.use(urlencoded(BODY_PARSER_OPTIONS));
|
|
13
13
|
app.use(cors(Object.assign({}, CORS_OPTIONS, corsOptions)));
|
|
14
14
|
app.use(compression());
|
|
15
|
+
if (prerenderToken) {
|
|
16
|
+
app.use(prerender.set('prerenderToken', prerenderToken));
|
|
17
|
+
}
|
|
15
18
|
childLogger.debug('Finished');
|
|
16
19
|
};
|
|
17
20
|
};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
module.exports = ({ express,
|
|
3
|
+
module.exports = ({ express, logger }) => {
|
|
4
4
|
return function load(app, { staticFiles: { baseUrl, folderPath, indexFilePath } }) {
|
|
5
5
|
const childLogger = logger.where(__filename, 'load');
|
|
6
6
|
childLogger.debug('Started');
|
|
7
|
-
// Use prerendering middleware
|
|
8
|
-
app.use(prerender);
|
|
9
7
|
// Use Express built-in middleware
|
|
10
8
|
app.use(baseUrl, express.static(folderPath));
|
|
11
9
|
// Load static endpoint
|