From 071b69a6e616532d9656d6c0d90537673f53bdd0 Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Fri, 19 Apr 2019 16:22:24 +0530 Subject: [PATCH] fixing payload size restriction issue by increasing its size. --- index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/index.js b/index.js index c1fa3bd..5d6827d 100644 --- a/index.js +++ b/index.js @@ -6,6 +6,7 @@ const http = require('http') const config = require('config') const app = require('connect')() +const bodyParser = require('body-parser') const swaggerTools = require('swagger-tools') const jsyaml = require('js-yaml') @@ -26,6 +27,10 @@ const options = { const spec = fs.readFileSync(path.join(__dirname, 'api/swagger.yaml'), 'utf8') const swaggerDoc = jsyaml.safeLoad(spec) +// Extending payload size +app.use(bodyParser.json({limit: '10mb', extended: true})) +app.use(bodyParser.urlencoded({limit: '10mb', extended: true})) + // Initialize the Swagger middleware swaggerTools.initializeMiddleware(swaggerDoc, function (middleware) { // Interpret Swagger resources and attach metadata to request - must be first in swagger-tools middleware chain