Node.js请求实体太大,修改bodyParser.raw限制获取错误?

时间:2016-06-15 10:04:53

标签: node.js afnetworking body-parser

在节点中请求实体太大,使用正文解析器是一个常见的问题,我看到了很多解决方案。

问题是,当我尝试添加:

{
  "name": "App_Name",
  "version": "1.0.0",
  "description": "Some-Discription",
  "keywords": [
    "redux",
    "react",
    "router",
    "routing",
    "frontend",
    "client",
    "webpack",
    "babel",
    "sass",
    "foundation",
    "postcss"
  ],
  "main": "index.js",
  "scripts": {
    "start": "node server.js",
    "test": "mocha",
    "postinstall": "bower install && grunt build"
  },
  "author": "Nitesh",
  "license": "ISC",
  "dependencies": {
    "axios": "^0.11.1",
    "body-parser": "^1.15.1",
    "classnames": "^2.2.0",
    "connect": "^3.4.1",
    "firebase": "^3.0.3",
    "firebase-token-generator": "^2.0.0",
    "font-awesome": "^4.3.0",
    "foundation-sites": "^6.1.2",
    "json-loader": "^0.5.4",
    "mongodb": "^2.1.20",
    "mongoose": "^4.4.19",
    "react": "^0.14.5",
    "react-addons-update": "^0.14.7",
    "react-autosuggest": "^3.7.4",
    "react-dom": "^0.14.7",
    "react-modal": "^1.3.0",
    "react-router": "2.0.0-rc5",
    "react-router-redux": "^2.1.0",
    "react-simple-autocomplete": "^1.0.2",
    "redux": "^3.2.1",
    "redux-form": "^5.2.5",
    "redux-logger": "^2.5.2",
    "redux-thunk": "^1.0.3",
    "request": "^2.65.0",
    "rethinkdb": "^2.3.1",
    "sendgrid": "^2.0.0",
    "underscore": "^1.8.3",
    "what-input": "^1.1.4"
  },
  "optionalDependencies": {},
  "devDependencies": {
    "autoprefixer": "^6.3.2",
    "babel-core": "^6.3.15",
    "babel-loader": "^6.2.0",
    "babel-plugin-transform-runtime": "^6.5.0",
    "babel-preset-es2015": "^6.3.13",
    "babel-preset-react": "^6.3.13",
    "babel-preset-react-hmre": "^1.0.1",
    "babel-preset-stage-0": "^6.5.0",
    "babel-runtime": "^6.9.0",
    "css-loader": "^0.23.1",
    "express": "^4.13.3",
    "extract-text-webpack-plugin": "^1.0.1",
    "file-loader": "^0.8.5",
    "jquery": "^2.2.4",
    "node-sass": "^3.4.2",
    "postcss-loader": "^0.8.0",
    "react-redux": "^4.4.5",
    "redux-devtools": "^3.1.0",
    "redux-devtools-dock-monitor": "^1.0.1",
    "redux-devtools-log-monitor": "^1.0.3",
    "sass-loader": "^3.1.2",
    "script-loader": "^0.6.1",
    "serve-static": "^1.10.2",
    "style-loader": "^0.13.0",
    "url-loader": "^0.5.7",
    "webpack": "^1.9.11",
    "webpack-dev-middleware": "^1.2.0",
    "webpack-hot-middleware": "^2.2.0"
  }
}

这些代码还可以,但我仍然无法通过iOS Afnetworking上传图片:

app.use(bodyParser.raw({limit: "50mb"}));// !!!!TypeError: bodyParser.raw is not a function

我的bodyParser verision更新到1.15.1。 我使用Objective C,Afnetworking上传:

app.use(bodyParser.json({limit: "50mb"}));
app.use(bodyParser.urlencoded({limit: "50mb", extended: true, parameterLimit:50000}));

0 个答案:

没有答案