最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin1浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论