Skip to content
This repository has been archived by the owner on Jan 25, 2020. It is now read-only.

Route name query #93

Open
tapankumar opened this issue May 25, 2017 · 1 comment
Open

Route name query #93

tapankumar opened this issue May 25, 2017 · 1 comment

Comments

@tapankumar
Copy link

I have added a named route and would like to know how will I get the same via request object.

I want to know the name of the route which got matched.

Example:

router({ path: '/user/:id', name: 'user-info' })
.get(function (req, res) {
//Here I am looking for route name which got matched.
res.send(req.route.name);
});

@dsaraswati
Copy link

dsaraswati commented Jun 9, 2017

@tapankumar You can get it using req.baseUrl. We still have access to the same express's Request object as we used to while writing using plain express.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants