|
|
|
Ask HN: Is Express still "de-facto" for building Node back ends?
|
|
84 points
by scsteps
970 days ago
|
|
It's been a while since I've last used node to build a backend, and the last time I did Express was the go-to solution. Is that still the case?
I don't have much time to do too much research and I usually default to the most popular solution in such cases. |
|
Express's API is horrible. It's not integrated with Promises (async/await) at all, so be prepared to wrap every async endpoint (so probably all of them) with a custom error handling wrapper. If you don't (and don't have a big catch-block around the whole implementation), an unhandled error will hang the connection forever without a response.
Also, the API makes it pretty much impossible to write "wrapping" middleware, for example if you want output validation. As soon as an express middleware calls `next`, it's done and there's no way intercepting it before a response is sent.
It also still doesn't support Node's HTTP2, just some (nowadays) weird third-party HTTP2 implementation.
The standard `compression` middleware also seems abandoned, not supporting brotli (so you'll have worse loading times), despite Node.js natively providing the required functions for years.
I'll second `fastifiy` or `koa`.