Apart from being used by everybody, do they have any other reason for using JS? In general, I'm curious why JS is picking up so much for backend development? Is it just that people like using one language?
I work on a product where JS is about 80% of the stack. In my opinion the JS ecosystem is best categorized as a bunch of sugar-rushed chipmunks running around shouting "we need better tooling". And you know what, it kinda works and its nice. Great tooling, great third-party ecosystem, really high quality modules / frameworks backed by large companies, and all the advantages of V8 and co.
This may not be the venue for me to surface this, but I've been trying to wrap my head around the MEAN stack for about a month now, and it doesn't really even register to me as the same language. I'm using Angular on the front end and ExpressJS plus Mongoose (MongoDB) on the back end, so yeah, it's all technically Javascript, but the real learning curve was in working out how to get these big frameworks to do what I wanted. I sincerely believe that if I was using an Angular frontend to call a Django REST service, I'd have had the exact same amount of trouble grokking what was going on (async calls being the obvious exception).
When I was trying to learn Express it didn't make any sense to me, batteries were not included at the time and I'm sure they are now or you can just ask Yeoman and it shall be granted. Since then I've watched Rich Hickey talks and started to dig into Clojure and started to grok the whole computing stack. The Clojure way is to compose your own web services rather than configure them. I think express works the same way. Build what you need. Frameworks are always more productive for a hackathon or a pointy haired boss's deadline. For building a system that will be robust, maintainable, and scale to n, pure logic plus minimal libraries are superior in the long run. And far more secure, both through purity and obscurity.
You only spend some time grokking the basic syntax of the language.
Most of the time is spent getting the frameworks working and talking to one another. The frameworks having the same underlying language does not gives you much advantage.
> I'm curious why JS is picking up so much for backend development?
The reason I reach for Node on a project is to handle my websockets. I use Django REST Framework + Ember as my main tools (super fast to build with) but, based on my testing, Python can't hold a candle to Node when working with thousands of websockets. It works great for what it was designed for.
Have you tried using Tornado/Twisted for the websockets? I'm curious about performance.
I'm building a side project right now and I'm using Django running inside Tornado (it's pretty simple to setup, really) so I can both have my cake and eat it (easy APIs, and a layer I can use to maintain websockets.) I wonder if the performance would be comparable to Node?
I tried every variation I could get to work including tornado, asyncio, and pypy. In my simple "how many websockets can I open" tests python would start erroring by 10,000 (no Django, just an empty websocket) while node hit 40,000 and was still climbing. Eventually I concluded it was a case of "with sufficient thrust pigs fly just fine". I still like python; just doesn't seem to be worth the effort to try to adapt blocking libraries into a non-blocking use case.
That makes sense. I'm actually very pragmatic when it comes to this kind of stack and I'll be happy to replace my current Tornado frontend with a Node frontend when I hit the limit (for now it's a very niche usecase, just me and a few friends, so it might be that I never need to improve it.)
I use/have contributed to this project: https://github.com/hendrix/hendrix which is a wsgi wrapper that uses twisted to serve django apps. Websockets are among the first things you get out of it.
I ended up with my primary tools being DRF + React/Redux. I'm genuinely curious about Ember, but haven't had a chance to play with it. What do you think of it? How's it stack up versus React-based frontend setups, if you've evaluated them?
For new SPAs Ember rocks. Also keeping up with the latest and greatest Ember is a breeze. I would not however like to refactor an existing front end application to use Ember. Probably React is better suited for integration with existing front end applications.
Although Ember really feels like idiomatic Javascript to me and they try hard to adhere to new web standards (e.g. web components, ES6 modules) it is also very opinionated about what should go where and how.