ringa_lee
express解析body需要用到body-parser中间件
var express = require('express') var bodyParser = require('body-parser') var app = express() var jsonParser = bodyParser.json() var urlencodedParser = bodyParser.urlencoded({ extended: false }) app.post('/login', urlencodedParser, function (req, res) { if (!req.body) return res.sendStatus(400) res.send('welcome, ' + req.body.username) })
soonfy
express解析body需要用到body-parser中间件
soonfy