简体   繁体   English

如何在app.use express中配置强大?

[英]how to configure formidable in app.use express?

this is a simple question... how can i use formidable instead bodyparser()... 这是一个简单的问题......我如何使用强力而不是bodyparser()......

how to configure in app.use 如何在app.use中配置

app.configure(function(){
app.set('port', process.env.PORT || 9000);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.set('view options',{layout:false});
app.use(express.favicon());
app.use(express.bodyParser();
app.use(express.cookieParser('blocksecretpass'));
app.use(express.session());

im using expressjs 3 rc4 nodejs 0.8 formidable 1.0.11 on windows 7 64-bit why i need?? 即时通讯使用expressjs 3 rc4 nodejs 0.8强大的1.0.11在Windows 7 64位为什么我需要?? because i have to post some files and bodyparser() shutdown my node app this is the error 因为我必须发布一些文件和bodyparser()关闭我的节点应用程序这是错误

https://github.com/felixge/node-formidable/issues/34
https://github.com/felixge/node-formidable/issues/130

the solution to issues is app.use express.bodyparser before any other middleware that try to use async calls 在尝试使用异步调用的任何其他中间件之前,问题的解决方案是app.use express.bodyparser

tnx all tnx全部

Don't use .bodyParser() , it is being deprecated. 不要使用.bodyParser() ,它已被弃用。

Use 使用

app.use(express.json());
app.use(express.urlencoded());

Consider using alternatives: http://www.senchalabs.org/connect/multipart.html . 考虑使用替代方案: http//www.senchalabs.org/connect/multipart.html Formidable is one of them. 强大就是其中之一。

You're already using formidable. 你已经在使用强大的。 Express is based on connect and the multipart middleware is based on formidable. Express基于连接多部分中间件基于强大。 Have a look at the express example to learn how to upload files. 看一下快速示例 ,了解如何上传文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM