我发送变量' id'从索引页面到info / studs页面,它正在执行该部分,但我无法在app.js中使用该变量
extends layout
block content
.container
.col-md-4
h2 Name
a(href='../info/studs?id=#{user.id}') #{user.name}
and app.js file containing
app.get('/info/studs',function(req, res){
//Here I want to use variable 'id'
});
答案 0 :(得分:0)
查看req.query对象以获取更多信息。
专门回答这个问题:
app.get('/info/studs',function(req, res){
//Here I want to use variable 'id'
var id = req.query.id
//You can now use the 'id' variable as you want.
})