query string
xxx/checkpostcode/?postcode=11111
app.get('/checkpostcode', function(req, res) {
let postcode = req.query.postcode;
if(postcode!=11111){
return res.status(400).send({"msg":"invalid postcode"})
}
return res.status(200).send({"msg":"valid postcode"})
});
params
如果通过params方式发送
axios.get('/user', {
params: {
ID: 12345
}
})
则通过以下方式来取
req.params.ID