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?
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.
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.
Well, you can pretty much just search bodyParser , and replace it with express !
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.
Try to apply this in your app.js
instead.
app.use(bodyParser.json({limit: '50mb'}));
app.use(bodyParser.urlencoded({limit: '50mb'}));
Hope this help!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With