Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mean.io - Error: 'Request entity too large'. How to increase bodyParser limit outside meanio module?

I am receiving following error with mean.io application.

Error: request entity too large

To overcome this issue, I have increased the bodyParser limit with in meanio module at following location.

node_modules/meanio/lib/core_modules/server/ExpressEngine.js

// Request body parsing middleware should be above methodOverride
  this.app.use(expressValidator());
  this.app.use(bodyParser.json({limit: '50mb'}));
  
  this.app.use(bodyParser.urlencoded({
    limit: '50mb',
    extended: true
  }));
  this.app.use(methodOverride());

However this is a bad practice and the changes will be lost if we upgrade the module. Can anyone suggest any alternative way to increase request limit at meanio app?

like image 855
Ravi Samanthapudi Avatar asked Apr 29 '15 09:04

Ravi Samanthapudi


People also ask

How do I fix request entity too large node?

To fix the “413 Request Entity Too Large” error in an Express application, you only have to update the server initialization file. This is generally called index. js or server. js and is where you initialize the Express server.

What is the alternative of bodyParser?

Top Alternatives to body-parser js. JavaScript library for DOM operations. React is a JavaScript library for building user interfaces. React package for working with the DOM.

What can I use instead of bodyParser JSON?

Well, you can pretty much just search bodyParser , and replace it with express !

What is extended in bodyParser?

The extended option allows to choose between parsing the URL-encoded data with the querystring library (when false ) or the qs library (when true ). The “extended” syntax allows for rich objects and arrays to be encoded into the URL-encoded format, allowing for a JSON-like experience with URL-encoded.


1 Answers

Try to apply this in your app.js instead.

app.use(bodyParser.json({limit: '50mb'}));
app.use(bodyParser.urlencoded({limit: '50mb'}));

Hope this help!

like image 62
Zachary Dahan Avatar answered Sep 29 '22 01:09

Zachary Dahan