@apolitical/server 2.0.1-beta.3 → 2.0.1

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/CHANGELOG.md CHANGED
@@ -8,7 +8,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
  ## [2.0.1] - 2022-01-21
9
9
  ### Added
10
10
  - Correlation when logging from error middleware
11
- - Dynamically update documentation to set the host
12
11
 
13
12
  ## [2.0.0] - 2022-01-20
14
13
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apolitical/server",
3
- "version": "2.0.1-beta.3",
3
+ "version": "2.0.1",
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",
@@ -12,18 +12,12 @@ module.exports = ({
12
12
  return function load(app, { swaggerDocument }) {
13
13
  const childLogger = logger.where(__filename, 'load');
14
14
  childLogger.debug('Started');
15
- // Internal middleware to dynamically set the host
16
- function hostMiddleware(req, res, next) {
17
- swaggerDocument.host = req.get('host');
18
- req.swaggerDoc = swaggerDocument;
19
- next();
20
- }
21
15
  // Load document endpoint
22
16
  if (swaggerDocument) {
23
17
  // Redirection to documentation
24
18
  app.use(`${DOCUMENTATION}index.html`, (req, res) => res.redirect(MOVED_PERMANENTLY, DOCUMENTATION));
25
19
  // Documentation express setup
26
- app.use(DOCUMENTATION, authorisationMiddleware(), hostMiddleware, serve, setup());
20
+ app.use(DOCUMENTATION, authorisationMiddleware(), serve, setup(swaggerDocument));
27
21
  }
28
22
  childLogger.debug('Finished');
29
23
  };