node.jsrequestandresponserelated
一 取值 post 和get取值
成都创新互联从2013年创立,先为下冶等服务建站,下冶等地企业,进行企业商务咨询服务。为下冶企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。
1)
GET /test?name=fred&tel=0926xxx572
app.get('/test', function(req, res) {
console.log(req.query.name);
console.log(req.query.tel);
});
2)POST
app.post('/test', function(req, res) {
console.log(req.query.id);
console.log(req.body.name);
console.log(req.body.tel);
});
3) HTTP Routing :
GET /hello/fred/0926xxx572
app.get('/hello/:name/:tel', function(req, res) {
console.log(req.params.name);
console.log(req.params.tel);
});
参考:
https://cnodejs.org/topic/50a333d7637ffa4155c62ddb
分享标题:node.jsrequestandresponserelated
当前链接:http://myzitong.com/article/pcgpgh.html