-
-
Save Shuumatsu/79823fb6223c11dbeaec0b17cfdb43a4 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
fn = compose(this.middleware); | |
if (!this.listeners('error').length) this.on('error', this.onerror); | |
const handleRequest = (req, res) => { | |
res.statusCode = 404; | |
const ctx = this.createContext(req, res); | |
const onerror = err => ctx.onerror(err); | |
const handleResponse = () => respond(ctx); | |
onFinished(res, onerror); | |
fn(ctx).then(handleResponse).catch(onerror); | |
}; | |
return handleRequest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment