So, presumably for the same reason somebody would do a project in ROR.
So, presumably for the same reason somebody would do a project in ROR.
Looking around at actual production node code, huge swathes of it could easily be written in Rails, Django, or Symfony with no real loss of performance or developer productivity. (And given the maturity of those ecosystems, probably a net gain in developer productivity. Example: ORMs aren't great at everything, but sometimes they save you a lot of time, and Node doesn't have an ORM that can compare to ActiveRecord, Doctrine, or SQLAlchemy.)
Node has found plenty of use outside of what it was originally built for (the canonical examples are web servers). As far as I can tell, it's used more widely and critically as a tool for packaging client-side scripts or for client-side applications (vscode, electron, Slack).
Examples of places where it seems like node would be an obvious choice, but it's not: blogs (WordPress still reigns), Mozilla's Add-ons (runs on Django [1]), Slack (very heavy user of JS on the front end, but backend is coded in PHP [1]), Zapier [2] (Python backend, though custom integrations are often written in JavaScript)
1: https://github.com/mozilla/addons-server
2: https://slack.engineering/taking-php-seriously-cf7a60065329?...
3: https://zapier.com/engineering/automating-billions-of-tasks/
Even as a giant fan of Elixir, Rails still has a firm place in the "choose for a new project" bucket.
If your goal is an SPA and your backend performance is a concern you’re better off with Go or Elixir than either of them.
If you're an experienced dev, this is a nitpick. But for new users, this is a major hurdle.
Edit: as an aside, I'd rather use Rails or Laravel for an api unless the backend had to be a set of microservices for some reason. Less time writing architecture, more time writing biz logic :).