Basic route is like this:
app.get(\'/\', function(req, res){
res.send(\'hello world\');
});
Is it possible to name that route and have it
I found express-reverse to nicely solve this issue
https://github.com/dizlexik/express-reverse
It augments the standard routing allowing you to pass the route's name as first argument
app.get('test', '/hello/:x', function(req, res, next) {
res.end('hello ' + req.params.x);
});
Let you build the url from inside a template by name
Test
Let you redirect to an url by name
app.get('/test-redirect', function(req, res, next) {
res.redirectToRoute('test', { x: 'world' });
});