Moved request-id mw into parent app

- Moved request-id from shared to parent as it is not shared
- This file is only used in one place, this updates the code structure to reflect this
- This is one of many similar changes needed to make it easier to refactor to the existing setup
This commit is contained in:
Hannah Wolfe 2020-04-21 18:25:53 +01:00
parent becc239de1
commit 8fe56852e0
5 changed files with 6 additions and 6 deletions

View File

@ -5,6 +5,7 @@ const config = require('../../config');
const compress = require('compression');
const netjet = require('netjet');
const shared = require('../shared');
const mw = require('./middleware');
const escapeRegExp = require('lodash.escaperegexp');
const {URL} = require('url');
const sentry = require('../../sentry');
@ -20,7 +21,7 @@ module.exports = function setupParentApp(options = {}) {
// (X-Forwarded-Proto header will be checked, if present)
parentApp.enable('trust proxy');
parentApp.use(shared.middlewares.requestId);
parentApp.use(mw.requestId);
parentApp.use(shared.middlewares.logRequest);
// Register event emmiter on req/res to trigger cache invalidation webhook event

View File

@ -0,0 +1,3 @@
module.exports = {
requestId: require('./request-id')
};

View File

@ -51,10 +51,6 @@ module.exports = {
return require('./pretty-urls');
},
get requestId() {
return require('./request-id');
},
get uncapitalise() {
return require('./uncapitalise');
},

View File

@ -2,7 +2,7 @@ const should = require('should');
const sinon = require('sinon');
const validator = require('validator');
const requestId = require('../../../../core/server/web/shared/middlewares/request-id');
const requestId = require('../../../../../core/server/web/parent/middleware/request-id');
describe('Request ID middleware', function () {
var res, req, next;