Live data from Hacker News

Node.js 20 is now available

nodejs.org

21–30 of 101 posts

Re: Node.js 20 is now available

#21
post #6

What is the standard web application backend framework for Node.js these days, is it Koa? As I understand it express is quite dated because of the callback structure. I have been confused recently with the moving best practices. What is the server architecture Next.js is most often plugged into?

You can get pretty far with Next API routes as a replacement for a seperate Express backend.

https://nextjs.org/docs/api-routes/introduction

Re: Node.js 20 is now available

#22
With testing built into core, I’m looking forward to the reduction in complexity and number of external testing frameworks.

I generally chose tape/ava in the past and vitest these days, but it’s awesome that now a very simple testing mechanism is available in core

Re: Node.js 20 is now available

#23
post #6

What is the standard web application backend framework for Node.js these days, is it Koa? As I understand it express is quite dated because of the callback structure. I have been confused recently with the moving best practices. What is the server architecture Next.js is most often plugged into?

I've used Koa in my last few work projects but will be either switching back to Express or moving onto Fastify for the next one. Like you mentioned, Koa does indeed feel dated. It's community never really took off, either; many of it's most popular helper/companion libraries haven't been updated in years.

Re: Node.js 20 is now available

#24
post #6

What is the standard web application backend framework for Node.js these days, is it Koa? As I understand it express is quite dated because of the callback structure. I have been confused recently with the moving best practices. What is the server architecture Next.js is most often plugged into?

Who cares how old something is, if it works well, why not use it? You can easily avoid callback-hell by making the callback you pass in to expressjs async and use await inside of it, without much drawbacks. Just because the first closure into express is a callback doesn't mean you need to use callbacks everywhere, just use await/generators/whatever you want in your application code. expressjs at this point is battle-…

> You can easily avoid callback-hell by making the callback you pass in to expressjs async and use await inside of it, without much drawbacks.

I thought this was slightly awkward due to error handling, but it looks like Express 5 (in beta) supports async callbacks natively.

Re: Node.js 20 is now available

#26
post #4

Love this. I wonder if we'll eventually have a new merge à la io.js/node.js Deno and Node are converging more and more on every release, such a deja vu. The main difference being that deno offers much more as a business than just the "deno" product itself, so an eventual merge wouldn't be so trivial. Denode or Nodeno? Who wants to place bets?

I sure hope not. NodeJS is a FOSS project under the Linux foundation (via OpenJS) and is not driven by profit, while Deno is developed by a for-profit company (Deno Land Inc) which has bunch of closed sourced projects to fund the company. Hopefully, NodeJS learned from the whole Npm Inc history and tries to remain more independent from for-profit companies. The whole io.js thing was a very different thing than Deno.…

Very good points. Deno is first and foremost a cloud business who happens to offer a Javascript runtime of its own making.

It made us see a world where javascript can be (much more) secure and typed without a compilation step, and this is an important contribution I would like to still acknowledge.

Now the fact that NodeJS is learning from Deno and making strides to support capabilities (are you related? lol) is extremely exciting to me and it will surely improve the state of the Javascript/Typescript ecosystem and pull along a lot of projects/devs who would never have moved to something like this purely due to inertia and dev cost. One can dream.

Re: Node.js 20 is now available

#27
post #6

What is the standard web application backend framework for Node.js these days, is it Koa? As I understand it express is quite dated because of the callback structure. I have been confused recently with the moving best practices. What is the server architecture Next.js is most often plugged into?

Express. Same as it’s ben for a decade.

Re: Node.js 20 is now available

#28
post #6

What is the standard web application backend framework for Node.js these days, is it Koa? As I understand it express is quite dated because of the callback structure. I have been confused recently with the moving best practices. What is the server architecture Next.js is most often plugged into?

[dead]

Re: Node.js 20 is now available

#29
post #6

What is the standard web application backend framework for Node.js these days, is it Koa? As I understand it express is quite dated because of the callback structure. I have been confused recently with the moving best practices. What is the server architecture Next.js is most often plugged into?

Callbacks in JS aren't really dated, just many of the patterns associated with them are. The Promise constructor itself takes two callbacks as its arguments. Async/await are just syntax sugar over that constructor. Express supports promise-based mw callbacks just fine.

So I'd still say Express is the main choice. Personally I've never loved the Express API as it encourages a lot of heavy mutation (Koa does too), so I tend to be on the lookout for good alternatives - I haven't seen any that seem to be sticking (gaining significant enough community to bet on) more than Express.

There's a few things like Next/SvelteKit that cover all bases in one, from your web app backend -> SSR frontend -> client states, but if you're looking at pure backend for e.g. an API, Express is still going strong.

Re: Node.js 20 is now available

#30
post #23
post #6

What is the standard web application backend framework for Node.js these days, is it Koa? As I understand it express is quite dated because of the callback structure. I have been confused recently with the moving best practices. What is the server architecture Next.js is most often plugged into?

I've used Koa in my last few work projects but will be either switching back to Express or moving onto Fastify for the next one. Like you mentioned, Koa does indeed feel dated. It's community never really took off, either; many of it's most popular helper/companion libraries haven't been updated in years.

I still use Koa out of habit since it was the only framework for a while that had first-class promise support.

One thing nice about Koa is that it's simple, so it's timeless in that way—it's not a moving target nor does it try to do something that needs a lot of core maintainers.

Post reply on HN