How to get current url in view in expressjs

I want to change class of some menu items based on the current url being viewed by user in expressjs app. I am using ejs templating system in expressjs How do i pass current url and mangage current view class in links? Should I pass current url vale in each res.render? or is some variable passed in view that can be used?

We can actually use

//pass user data
app.use(function(req, res, next) {
res.locals.variable = req.variable;
next();
});

and access the variable in view file.

you can pass the actual class or an indicator for which class to use as a template variable in res.render instead of passing the url and doing the actual parsing within the template.