I'm not saying javascript is the king of languages, just that we're limited to it because that's what's in the browser, and writing server code in the same language simplifies things.
I'm not saying javascript is the king of languages, just that we're limited to it because that's what's in the browser, and writing server code in the same language simplifies things.
That's a fallacy, the environments have nothing in common, the coding styles and interactions don't either, the only things you're going to be able to meaningfully share are trivial helper libraries à la underscore..
> and writing server code in the same language simplifies things.
Why? How? Where? I see that assertion often, but I have yet to see it backed by anything but "because I said so".
One example: you can run the same input validation in the client as you do in the server if you can easily share code between the two.
But there is way more. Here's an example of an application that shares all of its data models between client and server: http://tilemill.com/docs/models.html
The server and the client has such different concerns that code sharing probably wouldn't contribute that much.
Validation is also two different concerns if you compare serverside vs clientside.
http://stackoverflow.com/questions/162159/javascript-client-...
Basically: Client side validation is about user experience, Server side is about security. I'm hard pressed to believe you can get both with the same code.
I also don't see how localStorage is relevant to code sharing between client and server.
Using the same language on client and server can come in handy if you've got some non-trivial amount of code they can share in common. When I made a multi-user text editor (think Etherpad, but simpler), all the code for transforming the editing operations so that everybody's documents converge was written in a single JavaScript file, which I ran on both the client and the server, via node.js. That was great. That was fun. But if you don't have a situation like that, where's the advantage in using JS on the server?