Re:Show HN: Simple express-like routing for front-end
by olalonde on Wednesday August 17, 2016 @03:12AM
(#12302967)
One powerful feature of the Express router (but missing here) is that it's just a middleware, making composition trivial, e.g.:
[ Parent
| on HN ]
Re:Show HN: Simple express-like routing for front-end
by franciscop on Wednesday August 17, 2016 @03:20AM
(#12302990)
Ah that is really cool, recently a user requested a feature[1] that is basically this but I solved it in a different way [undocumented]:
pagex.base = '/users';
pagex('/', listUsers);
pagex('/:username', showUser);
pagex.base = '';
I am still considering extend it in this way: pagex.namespace('/users', function(pagex){
pagex('/', listUsers);
pagex('/:username', showUser);
});
[1] https://github.com/franciscop/pagex/issues/1
Re:Show HN: Simple express-like routing for front-end
by kevinsimper on Wednesday August 17, 2016 @05:36AM
(#12303401)
Why .namespace and not .use like express?
Re:Show HN: Simple express-like routing for front-end
by franciscop on Wednesday August 17, 2016 @11:42AM
(#12305514)
Because it is completely unrelated to express, and even with express that is not really how it works so it'd only cause confusion