Re:Is Express.js dying?
by pluma on Sunday January 17, 2016 @02:33PM
(#10920652)
I use express because it is the most barebones solution before vanilla http/https. The middleware API is trivial and relatively agnostic (most just expect node-style req/res objects and a `next(err?)` callback). The router does what it is supposed to and allows nesting.
However I would likely chose something different if my needs were different. If I wanted to implement REST APIs in Node I would use Hapi. If I wanted to build more complex web apps I might look into Koa (although I don't think I'll ever move back to classic server-only rendered apps).
Express is my JS equivalent of Ruby's Sinatra and Python's Flask. Nothing more, nothing less.
Addendum: I wouldn't say "everyone" has switched to Koa. Koa was handicapped by its conceptual overhead for most ordinary express users in its early days (relying on a combination of generators and promises -- both not yet sufficiently widely established and understood technologies at the time -- to build coroutines, which even fewer people understood). It has improved and the JS community seems to have caught up (just look what's going on with the Redux ecosystem -- "thunks" and "sagas" (essentially built around coroutines) are beginning to see some traction). But it didn't initially deliver the same "read this tutorial, start building apps" experience express had.
However I would likely chose something different if my needs were different. If I wanted to implement REST APIs in Node I would use Hapi. If I wanted to build more complex web apps I might look into Koa (although I don't think I'll ever move back to classic server-only rendered apps).
Express is my JS equivalent of Ruby's Sinatra and Python's Flask. Nothing more, nothing less.
Addendum: I wouldn't say "everyone" has switched to Koa. Koa was handicapped by its conceptual overhead for most ordinary express users in its early days (relying on a combination of generators and promises -- both not yet sufficiently widely established and understood technologies at the time -- to build coroutines, which even fewer people understood). It has improved and the JS community seems to have caught up (just look what's going on with the Redux ecosystem -- "thunks" and "sagas" (essentially built around coroutines) are beginning to see some traction). But it didn't initially deliver the same "read this tutorial, start building apps" experience express had.