如何获取req.params
值或名称来访问它?
我需要类似req.params = {track:'somevalue'}
或{id: 123}
....
app.use(function(req, res, next){
if(req.method == 'GET'){
var data = req.params; //params is undefined
}
})
app.get('/info/:track', (req, res) => {})
app.get('/profile/:id', (req, res) => {})
app.get('/courses/:session', (req, res) => {})
app.get('/somethingelse/:last', (req, res) => {})