在app.js中配置好用到的东西:

app.use(express.static(path.join(__dirname, 'build')));
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(require('connect').bodyParser());  //post方法传参必须配置的
app.use(bodyParser.urlencoded({ extended: false })) 
app.use(bodyParser.json())
app.use(express.methodOverride());
app.use(express.cookieParser('your secret here'));
app.use(express.session());
app.use(app.router);  //must be the last thing you call

开始时把app.use(app.router);放在了前面,结果无论怎样参数都传不过去,在网上查到结果:. You need to use app.use(express.bodyParser()) before app.use(app.router). In fact, app.use(app.router) should be the last thing you call.

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-05
  • 2022-12-23
  • 2021-12-31
  • 2021-10-07
猜你喜欢
  • 2022-12-23
  • 2021-10-06
  • 2021-12-26
  • 2022-03-08
  • 2022-12-23
  • 2022-01-14
  • 2021-10-17
相关资源
相似解决方案