I love threads like this, it's so stereotypical JS. OP asks if it's the de-facto choice which it objectively is, but everyone recommends their pet project or favourite library instead.
Ask HN: Is Express still "de-facto" for building Node back ends?
51–60 of 100 posts
Re: Ask HN: Is Express still "de-facto" for building Node back ends?
#52Follow-up question: Is there any backend framework which uses the fetch API. That is, where requests are standard Request objects ( https://developer.mozilla.org/en-US/docs/Web/API/Request ) and where you send (or return, or yield) standard Response objects ( https://developer.mozilla.org/en-US/docs/Web/API/Response )? I’m teaching a highschool kid web development and it would be very nice to be able to teach the sam…
Re: Ask HN: Is Express still "de-facto" for building Node back ends?
#53It's still the most popular but for the past couple of years it hasn't seen any major updates and some people question if the project is abandoned. I switched to Fastify and haven't looked back.
some people use the word abandoned... some people use the word "finished"
Re: Ask HN: Is Express still "de-facto" for building Node back ends?
#54Maybe it's still standard, but if you don't want to shoot yourself in the foot, just stay away from it. 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…
Re: Ask HN: Is Express still "de-facto" for building Node back ends?
#55I love threads like this, it's so stereotypical JS. OP asks if it's the de-facto choice which it objectively is, but everyone recommends their pet project or favourite library instead.
Also FWIW, there are a bunch of other popular options… but nearly all of them have roughly the same interface and follow the same general principles as express. Again, I wish it weren’t so. But you’re right, that isn’t responsive to the question being asked.
Re: Ask HN: Is Express still "de-facto" for building Node back ends?
#56It's still the most popular but for the past couple of years it hasn't seen any major updates and some people question if the project is abandoned. I switched to Fastify and haven't looked back.
some people use the word abandoned... some people use the word "finished"
Re: Ask HN: Is Express still "de-facto" for building Node back ends?
#57It seems like it. There are alternatives like Koa and Fastify, but none of seem to strike quite the balance that express does. I pray that one day express 5 will get released and they’ll finally fix the whole async middleware not handling errors properly thing though. That’s gotta be one of the most annoying quirks that has just been quietly sitting there untouched for years at this point. Maybe one day. I guess ther…
> async middleware not handling errors properly thing though Can you expand on this? Error handling in middleware is pretty well documented.
Re: Ask HN: Is Express still "de-facto" for building Node back ends?
#58No - please check out Hono https://github.com/honojs/hono
Express Weekly Downloads: 29,109,573
Come on, man.
Re: Ask HN: Is Express still "de-facto" for building Node back ends?
#59The reason I ask is because there are alternatives, like Google Cloud Functions [0], where you don't need a framework at all. You just write a handler and you're done. Connect it with Github actions for deployment.
There are other services out there, but I like GCF cause it'll auto scale. Need a database? Cloud SQL Postgres. Need a queue... Cloud Tasks... etc... so many problems solved in a relatively non-vendor lockin way.
EDIT: I'm getting downvoted for trying to make a helpful comment to the OP. Good work HN!
[0] https://cloud.google.com/functions/docs/console-quickstart
Re: Ask HN: Is Express still "de-facto" for building Node back ends?
#60Of the three, I'd choose Koa again over the others. Their design works better with modern javascript (async/await). While there may be fewer middleware packages for Koa than Express, it's usually not that hard to write your own if you can't find what you need.
For NestJS I didn't care for the decorator-driven "Spring-like" design. In JS codebases it's more natural to take a functional approach.