UNPKG

@lomray/microservice-gateway

Version:
31 lines (27 loc) 1.19 kB
'use strict'; var tslib = require('tslib'); var microserviceHelpers = require('@lomray/microservice-helpers'); var index = require('../constants/index.js'); var rawBodySaver = require('../helpers/raw-body-saver.js'); var cors = require('../middlewares/cors.js'); var userInfo = require('../middlewares/user-info.js'); var webhook = require('../middlewares/webhook.js'); /** * Microservice options */ const msOptions = Object.assign(Object.assign({}, microserviceHelpers.GetMsOptions(index)), { batchLimit: index.MS_BATCH_LIMIT, infoRoute: index.MS_INFO_ROUTE, reqTimeout: index.MS_REQ_TIMEOUT, listener: `0.0.0.0:${index.MS_LISTENER_PORT}`, jsonParams: { limit: `${index.MS_JSON_LIMIT}mb`, verify: rawBodySaver, } }); const msMiddlewares = [cors, webhook, userInfo]; /** * Microservice params */ const msParams = Object.assign({ beforeRoute: (express) => tslib.__awaiter(void 0, void 0, void 0, function* () { for (const middleware of msMiddlewares) { express.use(yield middleware()); } }) }, microserviceHelpers.GetMsParams()); exports.msMiddlewares = msMiddlewares; exports.msOptions = msOptions; exports.msParams = msParams;