0
请求对象中的哪个地方是json?将json从发布请求发送到nodejs服务器
例如,我知道我可以用身体的解析器要做到这一点
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.post('/', function(req, res){
console.log(req.body)
res.json({ message: 'goodbye'})
})
然后开始我的服务器,并与
curl -H "Cont/json" -X POST -d '{"username":"xyz"}' http://localhost:3000/
打它,但有没有办法做到这一点没有身体解析器包括?我可以在请求中看到json吗?