2016-01-21 57 views

回答

2

您可以使用res.locals

你的路由前插入以下中間件的地方:

app.use(function(req, res, next) { 
    res.locals.req = req; 
    next(); 
}); 

這暴露req在你的模板中的變量。