Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function listUsers (req, callback) {
// use req as immutable input
// standard node error-first callback API
// success value of callback is a response-shaped object with properties: statusCode, headers, body
}
// I haven't built one of these, just riffing.
// Look at clojure and other functional languages for examples that might
// have reasonable counterparts in "functional-light" JS
// Thinking more along the lines of react/redux reducer style
// Problems with express:
// - the res object being so stateful, harder to test
// - middleware dependencies are implicit instead of explicit
// - "next" connect middleware API is not just standard error-first callback pattern
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.