這個是因為express升級了3.0之后把原來集成在express里的很多組件都拆分出去了,所以解決方法是
npm install body-parser
把原來的
app.use(express.bodyParser());
改成
/*支持json格式的參數(shù)*/
app.use(bodyParser.json());
app.use(bodyParser.urlencoded());
就可以了
這個是因為express升級了3.0之后把原來集成在express里的很多組件都拆分出去了,所以解決方法是
npm install body-parser
把原來的
app.use(express.bodyParser());
改成
/*支持json格式的參數(shù)*/
app.use(bodyParser.json());
app.use(bodyParser.urlencoded());
就可以了