返回列表

connect.multipart() will be removed in connect 3.0

默认分类 2014/04/21 08:15

原文地址:http://www.cjavaphp.com/q/answers-how-to-get-rid-of-connect-3-0-deprecation-alert-19581146.html

step 1: use each parser directly instead of app.use(express.bodyParser());

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

step 2: use a different multipart parser, for e.g: connect-multiparty can be used

app.use(require('connect-multiparty')())

work on connect 3 and express 4 hasn't begun yet because node 0.12 is taking a while to be released. there's nothing to update, yet.

原文地址:http://expressjs-book.com/forums/topic/replacement-for-bodyparser-connect-multipart/

文件上传

var multer = require('multer');

app.use(express.json());
app.use(express.urlencoded());
app.use(multer({ dest: './uploads/' }));