Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: Is Node.js still good for writing APIs?
14 points by 120bits on May 11, 2020 | hide | past | favorite | 14 comments
Hi,

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.

Thanks!



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.


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


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


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.


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


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.


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.


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.


What are your performance requirements?

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


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.


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.


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

Why are you asking the HN community?


Was it ever good?


Yes, and still is




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: