Javascript and its prototypical object system is great for client-side scripting code, but a poor fit for server domain concepts. You're going to have to learn multiple tools, languages, paradigms anyway. So just suck it up and use a proper back end framework too. Node's pretty good, but it's not Rails.
If you do solve that problem, in any language, then is implementing it in js really a necessity (apart from maybe a skill issue i.e. do you need people with a mix of skills or just js devs but again, I can't see why this is a problem)?
The client and the server have different jobs to do, how much code re-use is really happening in real world apps?
The promise of "code reuse" is very alluring but reusing application code rarely happens in reality. However, reuse of patterns and libraries is very common – solve a generic problem once and you don't have to research how to achieve the equivalent in another ecosystem. Just grab the exact same library, browserify the thing and you're done (ideally).
"One language everywhere" grants you lots of flexibility – where your code executes is no longer locked in stone – you can shift responsibilities from the server to client & vice-versa without significant overhead. No need to port to a different language which perhaps lacks similar paradigms or tooling. Doors are opened to optimisations and architectural changes that would not have even been a consideration otherwise.
To get the benefits of "one language everywhere" doesn't necessarily mean "use JavaScript" but it's a safe decision to choose the lowest common denominator; JavaScript is not going out of fashion any time soon, it runs on nearly every platform and has an ecosystem that's competitive in a wide gamut of problems. An investment in vanilla JS will pay out in long term, while any investment in Framework-X or compile-to-js Y or AltJS-Z is high risk and usually only pays out for the 18 months or so while said tool is in vogue.
JS may not be the best choice, but it's a smart choice.
While this sounds alluring, in practice I think it would mostly be limited to the kind of thing where you check something client-side (like whether a username meets the requirements) and then re-check it server-side because security 101.
Client-side code is about displaying things, turning JSON into buttons and widgets, etc. There is no point having that on server-side. The server does not have a human user clicking buttons and scrolling bars.
Server-side code is about performing calculations and facilitating communication between different clients. If these can be done client-side, then there's no reason to do them server-side in the first place.
>An investment in vanilla JS will pay out in long term
This is true, but a lot of JS investment is not in vanilla, it's in whatever framework is popular that week, and next week that framework will be dropped like bellbottom pants.
Actually, JS developers are learning that this is frequently better done on the server; there are more and more articles every week about the benefits of pre-rendering the application page on the server side, then letting the client JS take over and make the server generated code responsive.
I believe the term being used is "isomorphic" javascript.
However, since the Node.js server is inherently single threaded, the cost of generating these templates server side impacts every connection being handled by that particular instance.
is somewhat contradicted by
> browserify the thing and you're done
Browserifying a library might seem conceptually simple, but if it was written with a particular usage in mind, it will really include writing a set of non-trivial shims to make it work with, say, Ajax instead of `fs`.
If, on the other hand, you actually understand the problem at hand and are willing to write code instead of plumbing libraries together, you can frequently express the solution to that problem in remarkably few concise lines of code in any language. This alleviates the need for others to learn both the problem domain and the quirks of the library chosen to address that problem.
> having the same language in client and server can simplify the data management between them
That isn't called "simplified data management" it's called tightly coupled. What backend language/framework doesn't support json, xml (and even html fragments) for working with a JS frontend?