首页 > Web开发 > 详细

NodeJs传递参数遇到的错误

时间:2017-02-05 23:03:46      阅读:336      评论:0      收藏:0      [点我收藏+]

在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.

NodeJs传递参数遇到的错误

原文:http://www.cnblogs.com/lmy2016/p/6368719.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!