javascript - how to configure formidable in app.use express? - Stack Overflow

this is a simple question... how can i use formidable instead bodyparser()...how to configure in app.us

this is a simple question... how can i use formidable instead bodyparser()...

how to configure in 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?? because i have to post some files and bodyparser() shutdown my node app this is the error



the solution to issues is app.use express.bodyparser before any other middleware that try to use async calls

tnx all

this is a simple question... how can i use formidable instead bodyparser()...

how to configure in 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?? because i have to post some files and bodyparser() shutdown my node app this is the error

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

the solution to issues is app.use express.bodyparser before any other middleware that try to use async calls

tnx all

Share Improve this question asked Sep 14, 2012 at 0:14 andrescabana86andrescabana86 1,7888 gold badges32 silver badges56 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

Don't use .bodyParser(), it is being deprecated.

Use

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

Consider using alternatives: http://www.senchalabs/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. Have a look at the express example to learn how to upload files.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745208489a4616705.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信