@restmatic/server
Version:
The core Pomegranate plugins for RestMatic
30 lines • 1.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @file PostRouter
* @author Jim Bulkowski <jim.b@paperelectron.com>
* @project server
* @license MIT {@link http://opensource.org/licenses/MIT}
*/
const fp_1 = require("lodash/fp");
const plugin_tools_1 = require("@pomegranate/plugin-tools");
const ExtractMiddleware_1 = require("./helpers/ExtractMiddleware");
exports.PostRouter = plugin_tools_1.CreatePlugin('action')
.configuration({
name: 'PostRouter',
depends: ['@restmatic/Router']
})
.variables({
middlewareOrder: ['404', '500']
})
.hooks({
load: (PluginInjector, PluginLogger, PluginVariables, Middleware, Express) => {
PluginLogger.log('Configuring post-route Middleware', 1);
let MountMiddleware = ExtractMiddleware_1.extractMiddleware(Middleware);
fp_1.each((mw) => {
PluginLogger.log(`Adding post-route middleware: ${mw.name}.`);
Express.use(mw.fn);
}, MountMiddleware(PluginVariables.middlewareOrder));
}
});
//# sourceMappingURL=PostRouter.js.map