Created
May 26, 2013 16:29
-
-
Save juliangruber/5653265 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
function _error (req, res) { | |
return function (str) { | |
// set status code etc... | |
res.end(str); | |
} | |
} | |
// Usage: | |
http.createServer(function (req, res) { | |
var error = _error(req, res); | |
// do some things... | |
return error('oh noes!'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment