1.配置动态路由
1.params传值(req.params.参数)
http://localhost:3000/users/111/books/22
app.get('/users/:userId/books/:bookId', function (req, res) {
res.send(req.params)
})
2.query传值(req.query.参数)
http://localhost:3000/product?aid=123&cid=456
app.get('/product',function(req,res){
console.log(req.query)
res.send('获取query传值---aid: '+req.query.aid+' cid: +'+req.query.cid)
})