Skip to content

Commit 3f61500

Browse files
author
sachin-maheshwari
authored
Merge pull request #27 from topcoder-platform/dev
Fix payload size issue by increasing request body size.
2 parents 917a7e6 + 071b69a commit 3f61500

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const http = require('http')
66
const config = require('config')
77

88
const app = require('connect')()
9+
const bodyParser = require('body-parser')
910
const swaggerTools = require('swagger-tools')
1011
const jsyaml = require('js-yaml')
1112

@@ -26,6 +27,10 @@ const options = {
2627
const spec = fs.readFileSync(path.join(__dirname, 'api/swagger.yaml'), 'utf8')
2728
const swaggerDoc = jsyaml.safeLoad(spec)
2829

30+
// Extending payload size
31+
app.use(bodyParser.json({limit: '10mb', extended: true}))
32+
app.use(bodyParser.urlencoded({limit: '10mb', extended: true}))
33+
2934
// Initialize the Swagger middleware
3035
swaggerTools.initializeMiddleware(swaggerDoc, function (middleware) {
3136
// Interpret Swagger resources and attach metadata to request - must be first in swagger-tools middleware chain

0 commit comments

Comments
 (0)