Last active
August 29, 2015 13:57
-
-
Save totherik/9468678 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module.exports = function (router, registry) { | |
router.get(registry.path('my-route', '/foo'), function (req, res) { | |
res.send('ok'); | |
}); | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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