Skip to content

Commit

Permalink
Increase body size limit (#16)
Browse files Browse the repository at this point in the history
* Increase body size limit

The default limit of the json body parser is 100kb, which does not allow for rendering large documents.

Increase the limit to 2mb to be in line with the default nginx body size limit.

* Make body size limit configurable

Allow the default value of 2mb to be overridden if required with an environment variable
  • Loading branch information
lennym authored and JoeChapman committed Mar 9, 2018
1 parent dfc9663 commit 0a4cdec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const config = {
port: process.env.APP_PORT || 8001,
host: process.env.APP_HOST || 'localhost',
env: process.env.NODE_ENV,
loglevel: process.env.LOG_LEVEL
loglevel: process.env.LOG_LEVEL,
limit: process.env.BODY_SIZE_LIMIT || '2mb'
};

module.exports = config;
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const errorHandler = require('./middleware/error-handler');

app.use(churchill(logger));

app.use(bodyParser.json());
app.use(bodyParser.json({ limit: config.limit }));

app.use('/convert', controller);
app.use(errorHandler);
Expand Down

0 comments on commit 0a4cdec

Please sign in to comment.