UNPKG

@gabliam/express

Version:
21 lines (20 loc) 811 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.addMiddlewares = void 0; const tslib_1 = require("tslib"); const body_parser_1 = tslib_1.__importDefault(require("body-parser")); const constants_1 = require("../constants"); const addMiddlewares = (app, container) => { const config = container.get(constants_1.EXPRESS_PLUGIN_CONFIG); app.disable('x-powered-by'); if (config.bodyParser.json) { app.use(body_parser_1.default.json(config.bodyParser.optionsJson)); } if (config.bodyParser.urlencoded) { app.use(body_parser_1.default.json(config.bodyParser.optionsUrlencoded)); } if (config.bodyParser.text) { app.use(body_parser_1.default.json(config.bodyParser.optionsText)); } }; exports.addMiddlewares = addMiddlewares;