Skip to content

Commit

Permalink
Add ability to install proxy middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielWHoward committed Jul 8, 2020
1 parent b9862cb commit a7a16ce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ exports.install = (pluginContext) => {
description: 'Path to private SSL key (optional)'
},

middleware: {
type: Object,
description: 'Object to install middleware'
},

routeNotFound: {
type: Function,
description: 'Function to handle missing routes (optional)'
Expand Down
5 changes: 5 additions & 0 deletions initializeRestHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ module.exports = (httpServer) => {
const logger = httpServer.logger;
const requestLogger = httpServer.requestLogger;
const colorsEnabled = project.getColors();
const middleware = project.getMiddleware();
const routeNotFound = project.getRouteNotFound();

if (middleware) {
httpServer.restHandler.middleware(middleware);
}

httpServer.restHandler
.on('route', (event) => {
let desc;
Expand Down

0 comments on commit a7a16ce

Please sign in to comment.