2 ms·
The other main difference between koa and express is that, in express, you send responses from handlers while in koa, you bubble up a {req,res} context back to
by hombre_fatal 8y ago
The other main difference between koa and express is that, in express, you send responses from handlers while in koa, you bubble up a {req,res} context back to koa which sends it which gives you real middleware since you can still mutate the response.
The promise chaining nature also makes it so that your example handler can catch all downstream errors unlike express where you must call next(err) and handle it in a downstream handler vs koa's upstream middleware pattern (clojure's ring works the same way).
I thank co and early koa for making node bearable for me long before async/await were available.