Golang really shines when it comes to REST APIs
For example, it can actually squeeze more out of each container because I’m assuming that you’re running things in a container than node will be able to do. Now you can do certain things like you can create multiple thread workers and so forth nodejs, but in general, you don’t! That’s where go really comes in and it kind of comes into its own. Go is really great for a small service that needs performance and a REST API depending. It kind of depends of course, on the size of the REST API as well, but for the most
As I said, it really depends on your setup if you are making a standard simple REST API, for you that does not have a very specific type of use case then I would choose nodejs because as I said there are a lot of other benefits to using nodejs.
NodeJs is great for boilerplate
In theory, you could use something like typescript for example, or flow to get the typing system but on average that’s the way that I think about it. I said nodejs is great for boilerplate like you suddenly some standard type of rest API, but if you need to squeeze the absolute living out of the performance or you need a typing system to help you out.
In other words you have a really large rest API or maybe you’re doing something like stripe for example like a payment providing type of rest interface then go every single day of the week because, it’s going to handle more load over time and as I said with the typing system you can actually maintain your code and keep it good for longer that’s at least how I feel about it.
So that’s a kind of where it boils down to you go with nodejs if you’re making something small or something very standard that doesn’t need any type of specific thing, it’s just a normal old application or normal old rest API and you go with go if you need extra performance and a typing system that’s at least how I feel about it, this actually exactly what uber found to be true for them when they switched over, they have a lot of nodejs microservices in their ecosystem and one of them was specifically under a lot of stress because it was needed in order to make a lot of other services work.
So it was like bombarded by tons and tons and tons of requests every second so they rewrote that in Golang in order to improve the overall performance because they could actually realize that they could actually squeeze more out of the hardware that the container was running on by simply leveraging go. So that’s my answer to you use nodejs if you don’t have anything specific in mind and use Golang if you need a type system, in other words you’re dealing with money or some type of very advanced rest API and you need the extra performance.