Skip to content

Instantly share code, notes, and snippets.

@totherik
Last active August 29, 2015 13:57
Show Gist options
  • Save totherik/9468678 to your computer and use it in GitHub Desktop.
Save totherik/9468678 to your computer and use it in GitHub Desktop.
'use strict';
module.exports = function (router) {
// Register function under slugified function name: `my-foo-route`
// Similar to `named.js`, the more I think about it not sure how this would work.
router.get('/foo', function myFooRoute(req, res) {
res.send('ok');
});
};
// Only feasible by proxying `router`
'use strict';
module.exports = function (router) {
// The more I think about it not sure how this would work.
router.get('/foo', router.name('my-foo', function (req, res) {
res.send('ok');
}));
}
// Only feasible by proxying `router`
'use strict';
module.exports = function (router, registry) {
router.get(registry.path('my-route', '/foo'), function (req, res) {
res.send('ok');
});
};
'use strict';
module.exports = function (registry) {
// Invocation of `registry` returns an instance of `express.Router`
registry('my-route').get('/foo', function (req, res) {
res.send('ok');
});
};
// Only feasible by proxying router.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment