
Ask HN: Is Node.js still good for writing APIs? - 120bits
Hi,<p>I wanted to know if NodeJS is still good option to write backend and for REST APIs. How does it stack up against GO? Are there any particular frameworks for high performance in Node.<p>Thanks!
======
_bxg1
Node is best-suited for when your API itself does very little CPU work. When
it serves mainly as a task-delegator to a DB, other APIs, local disk I/O, etc.
All of these are non-blocked by JS and automatically handled by underlying
native code in parallel. The main advantage of Node compared to Go is that
your front- and back-end can be in the same language, which helps with hiring
and can even allow for code-sharing.

That said I don't think Node would ever match Go on raw performance, even in
its wheelhouse. It's all about tradeoffs.

~~~
neophyt3
what if wasm become production ready... dont u think that cpu intensive will
be native and difference will be somewhat closer?

~~~
jwalgenbach
No. Wasm is still executing on a virtual machine, and native compiled go code
will still be native.

~~~
_bxg1
This question isn't so clear-cut. Go is still garbage-collected, which means
that depending on what kind of program we're talking about, some well-memory-
managed WASM code could conceivably still be faster.

------
vekker
For the average CRUD app, even complex ones, I really like using NestJS (in
combination with Angular in the frontend)

------
talmr
Node is a great choice for fast iteration for a rest api if all you're doing
is hitting DB, firing off other services, etc.

Express is a solid choice imo due to the tremendous community support.

If you ever need to do anything that involves CPU crunching, you can move
those requirements to another language that's better suited for it like Go.

------
greatwhitenorth
If you don't do much CPU work, node.js is great. If your load is on the DB
(or) you offload the work to a background queue, you're good.

If you already know JavaScript, just go with Node.js. If you end up with
performance bottleneck (CPU bound operation), you can always write that in Go.
Don't waste time upfront.

------
wprapido
If you don't need much in terms of computing power or you just use the API for
delegation, Node makes for a good choice. It's a mature ecosystem, well
documented, well supported, has excellent community.

------
BrandonBradley
What are your performance requirements?

If you have none, this is probably a pre-optimization.

------
el_dev_hell
I enjoy Node when I'm pulling from several external APIs and need to pipe the
data somewhere with minor mutations.

Pretty much every API will have a JavaScript library/documentation, which is a
huge time saver.

------
thepiratesailor
Node.js does not beat Go Lang in terms of handling large numbers of request
and performance (of course)

So the question is Node.js good? Depends on your use case. Test yourself and
decide yourself for your use case.

------
adreamingsoul
Apples and Oranges. Depending on your needs and goals, each has it's own
pros/cons.

Why are you asking the HN community?

------
gregjor
Was it ever good?

~~~
PixelPaul
Yes, and still is

