admin管理员组

文章数量:1415111

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.

本文标签: javascripthow to configure formidable in appuse expressStack Overflow