Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save shubham7298/816fc366b51bce6c626c635c4f2c71c2 to your computer and use it in GitHub Desktop.
Save shubham7298/816fc366b51bce6c626c635c4f2c71c2 to your computer and use it in GitHub Desktop.
When you face an error 413 Payload too large in NodeJS, use this to fix that out
const express = require('express');
const bodyParser = require('body-parser');
...
// Express 4.0
app.use(bodyParser.json({ limit: '10mb' }));
app.use(bodyParser.urlencoded({ extended: true, limit: '10mb' }));
// Express 3.0
app.use(express.json({ limit: '10mb' }));
app.use(express.urlencoded({ limit: '10mb' }));
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment