Created
June 10, 2020 17:49
-
-
Save RobertBrewitz/5b8c56bc54f17c0a0bd87b6c8c6dbef5 to your computer and use it in GitHub Desktop.
Acquiring Express Router routes
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
const req = { method: 'POST', path: '/' }; | |
const res = { send: jest.fn() } | |
const request = (req, res) => { | |
return jobs.stack | |
.find((layer) => { | |
return ( | |
layer.route.path === req.path && | |
layer.route.methods[req.method.toLowerCase()] | |
); | |
}) | |
.handle(req, res); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment