Live data from Hacker News

Node.js 20 is now available

nodejs.org

51–60 of 101 posts

Re: Node.js 20 is now available

#51

Earlier quoted context omitted.

Why are you referring to it as that?

The big new feature is a sandboxing with explicit CLI flag opt in to permissions, exactly like deno pioneered. Except there's zero mention of deno as a clear inspiration of the feature.

Kind of reminds me of deno's support for package.json after realizing they needed the features.

Re: Node.js 20 is now available

#52
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?

When standing up a server I reach for fastify.

The only exception is when I’m working inside an established Node shop where they already have a prolific framework, I’ll reach for what they already have in that case to avoid fragmenting their stack. Almost always, that’s express.

fastify is performant, thoughtfully designed, and well architected.

Re: Node.js 20 is now available

#53
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-…

> It's very mature and does what it does well.

Is it? It performs slower than e.g. Fastify. Don't see how that's doing well.

> Who cares how old something is, if it works well, why not use it?

It doesn't. That's the whole point. Software is always evolving and I doubt it's even close to complete. There hasn't been meaningful updates to Express in a long time. Why do people use it and/or promote it as a standard?

Re: Node.js 20 is now available

#54
post #46

Earlier quoted context omitted.

The big problem is Express code like the following will either hang the HTTP request forever (--unhandled-rejections=warn), until the client times out and gives up, or crash your whole server, taking down any other HTTP requests in progress (--unhandled-rejections=throw): const db = { async getUsers() { throw new Error("failed to connect to database"); }, }; app.get("/", async (req, res) => { const result = await db.…

Already fixed in Express 5 (which is technically still in beta, but that just seems to be the maintainer being very conservative about a major release): https://expressjs.com/en/guide/error-handling.html > Starting with Express 5, route handlers and middleware that return a Promise will call next(value) automatically when they reject or throw an error. For example: > app.get('/user/:id', async (req, res, next) => { c…

> which is technically still in beta, but that just seems to be the maintainer being very conservative about a major release

There hasn't been a new beta in a long time. Last release about a year ago and then the 1 before that about 3 years ago. Not a very convincing beta.

Re: Node.js 20 is now available

#55

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

A shame it's not using `expect` syntax, which recently was also adopted by bun.

    expect(me).to.barf.when(i.see(shit.like(this)));

Re: Node.js 20 is now available

#56
post #54

Earlier quoted context omitted.

Already fixed in Express 5 (which is technically still in beta, but that just seems to be the maintainer being very conservative about a major release): https://expressjs.com/en/guide/error-handling.html > Starting with Express 5, route handlers and middleware that return a Promise will call next(value) automatically when they reject or throw an error. For example: > app.get('/user/:id', async (req, res, next) => { c…

> which is technically still in beta, but that just seems to be the maintainer being very conservative about a major release There hasn't been a new beta in a long time. Last release about a year ago and then the 1 before that about 3 years ago. Not a very convincing beta.

I'm not sure whether you mean "not very convincing" in the sense of "not reassuring that it works" or something else, but judging from users' comments on this issue about the release plans, it seems to work just fine: https://github.com/expressjs/express/issues/4920

The maintainer said this three months ago in a comment on that issue:

> Express 5 is pretty much completed at this point, and we're just finishing up the last code merges in upstream modules in order to bump the dependencies finally in the 5.0 branch.

Re: Node.js 20 is now available

#57
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?

Koa works great. The nicest part is that you don't feel like you're fighting Typescript when you use it, if you use static types.

Re: Node.js 20 is now available

#58
post #38

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

Same. Every time I dive into a repo using Jest it infuriates me. So slow. The built in test runner is great.

Funny, I have the same reaction for Mocha and always wish it was Jest instead. I love that jest includes all the batteries to get stuff done.

Re: Node.js 20 is now available

#59
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?

Adding to this, these days, what's a complete nodejs MVC web framework that allows for easy integration of something like server-sided React for the front-end?

Re: Node.js 20 is now available

#60
post #55

Earlier quoted context omitted.

A shame it's not using `expect` syntax, which recently was also adopted by bun.

expect(me).to.barf.when(i.see(shit.like(this)));

It’s great for tab completion and can be very smart about types, and newer ones like jest don’t have excessive chaining style. Less bad than it used to be
Post reply on HN