Originally I used PHP for backends, but that was short-lived and I quickly switched to Java since it was a language I knew a lot better. I used the Jetty webserver in Java for a couple of years, albeit embedded with my own web libraries on top, and that served me pretty well. The only problem was that the threaded server model it used did a pretty poor job handling bad I/O logic because such logic would end up slowing down requests and taking up valuable threads I needed for serving other requests.
Fast forward to late 2018 when I switched from Jetty to Vert.x, an async Java sever framework, built on top of Netty. It provided way better concurrency obviously, so I was very happy with it, though using Java with it was painful because of Java lacking async/await or coroutines, causing every async call to need a callback. This slowed down development a lot, but I endured it because I knew Java so well, and didn't feel comfortable using anything else for a task like that. Later those pains were eased by switching to Kotlin for Vert.x, which had coroutines that greatly improved the time it would take me to write applications with it. During these developments, my opinion of NodeJS only made a slight shift from making fun of it relentlessly to tolerating it and at least acknowledging its usefulness.
So, that's how my development was for a pretty solid amount of time. Things in between that were me learning VueJS for frontend development and a lot of improvement in the SQL field. The pattern was only broken when I was approached for a job offer, a gig to build a forum in NodeJS. My first thoughts on it were basically a mix between "I really would love to do this in another language", and "Thank god it's not PHP", and that was about it. I took the job and began working on it. It was actually my first time building a full site from the ground up using NodeJS, so I picked up a sizable amount of skills in it very quickly, and that was pretty useful for getting an understanding of the toolkit. Besides that though, the first thing to hit me was that I actually wasn't missing strong typing as much as I was expecting. Turns out, web backend development that isn't incredibly data driven doesn't actually require a lot of strong typing, although I still think that strong typing is good in that domain. Point is, that was one fear (or I guess you could say "expected frustration") that never materialized, and I was making rapid progress on the project. Speaking of rapid, the time it took to start building the project was very very small compared to starting a new Java/Kotlin project. The setup was adding the libraries I needed (mainly Express and Knex), creating an
index.jsfile, and then adding routes to serve from. That kind of thing takes a lot more steps in a Java project for many reasons, but one of them is that the tooling is still somewhat stuck in the early 2000s. That's not to say that all of it is, since project setup became far less of a problem when the Gradle build system was widely adopted, but many of the conventions are just laborious and not necessary. Node simplified many of the steps and configurations that I would do manually with Gradle into single commands, and that's ignoring the fact that I don't have to compile JS code. Things were going unexpectedly well, and I was very surprised at how much I was not only tolerating Node, but actually enjoying the experience of writing in it.
Fast forward two weeks, and I have a fully working product, created entirely in Node, from the ground up. It was a good experience overall, and it quickly taught me exactly how useful Node was for pushing things out quickly, time crunch or not. I also want to make it clear that this was not sloppy work, this was fully documented and organized code, not half-assery. Saying I was impressed would have been an overstatement, but I was very satisfied with how quickly and easily Node let me build that. After working on the project, I had acquired a pretty decent grasp on the basic Node APIs (along with standard web libraries like Express), and so I began to use it for scripting around my system, replacing a lot of the buggy and poorly written scripts in Bash and Rtfl (I will write an article on this later).
Sparing the details, I began using Node more and more for various projects and paid work, most notably rewriting some of my IRC and Discord bots in it, replacing Kotlin. None of this was out of laziness either, I knew the domain of those projects and that Node would help and benefit them. What are those benefits that seemingly changed my mind from hating Node to then adopting it personally and rewriting several projects in it?
Well, it's a few things, but each one of those things cover big problems.
First! Starting a project in Node is trivial and takes almost no time. Contrasting this with the fact that starting a Java project takes a lot of time that could be used for writing the actual code, it provides a big advantage for smaller projects or scripts. This kind of thing doesn't matter on my big projects, but it has a massive impact on smaller projects and scripts that I just need to bang out really quickly.
Second! Modifying a Node program is very easy to do and does not require recompilation. Again, this is another domain-specific issue that is solved by Node, as I can develop incredibly quickly and just restart the process to get the changes, no recompile required.
Third! Unlike the others, this is a generic issue that is not domain specific and affects all of my projects. Node on average tends to use less RAM than the JVM. Some people complain about Node memory usage, but those people should take a look at what your average JVM is doing with your memory. A simple IRC bot I wrote in Kotlin would normally run up a mass of ~200mb memory usage on a regular basis, and garbage collection would not solve this. When I rewrote it in Node, it doesn't even use 30mb, even after running for months on end without any restarts. This issue is actually the main reason I rewrote my bots in Node, because they just take up less RAM on my small VPS.