i have a routes like
app.get('/home',requireLogin,routes.home)
exports.home = function(req, res){
res.render('index', { title: 'home' });
};
now if i want my url look like this
/home/menu/someting
do i have to create anothoer routes like
app.get('/home/menu/someting',requireLogin,routes.newRoutes)
or can i just modify the routes.home to handle the rest url,like if there is a second /something do something.
and i know that i can have home/:parameter ,but i need the url look exactly like home/menu/something and after something i will have the :parameter.
just answer me this is it possible to handle the /home and /home/menu in the same routes,no parameters
You can use both wildcards (*
) and named parameters (:parameter
) in your routes.
app.get('/home/menu/:something', ...)
Then use req.params.something
for the value.