mean.io-错误:“请求实体太大".如何增加meanio模块之外的bodyParser限制? [英] mean.io - Error: 'Request entity too large'. How to increase bodyParser limit outside meanio module?

查看:61
本文介绍了mean.io-错误:“请求实体太大".如何增加meanio模块之外的bodyParser限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

mean.io应用程序出现以下错误.

I am receiving following error with mean.io application.

Error: request entity too large

为解决此问题,我在以下位置的meanio模块中增加了bodyParser限制.

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());

但是,这是一个不好的做法,如果我们升级模块,更改将丢失.有人可以建议其他方法来提高Meanio应用程序的请求限制吗?

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?

推荐答案

实际上,这是他们更新代码的最新版本的npm meanio模块的问题.您需要更新npm meanio软件包.之后,您可以覆盖ExpressEngine.js文件中存在的方法.

I got this working actually it is the issue with npm meanio module in the latest version they have updated the code. You need to update the npm meanio package.After that you can able to overide the methods that are present in ExpressEngine.js file.

在github上为此打开了一个问题 https://github.com/linnovate/mean/issues/1169

There is a issue opened for this on github https://github.com/linnovate/mean/issues/1169

此后,他们已解决此问题并合并了代码

After this they have fixed this issue and merged the code

这篇关于mean.io-错误:“请求实体太大".如何增加meanio模块之外的bodyParser限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆