Re:Why Node.js Is Totally Awesome
by mcantor on Tuesday October 12, 2010 @10:11PM
(#1785772)
Why can't you run the same code...? Can't you at least use the same domain objects?
[ Parent
| on HN ]
Re:Why Node.js Is Totally Awesome
by WesleyJohnson on Tuesday October 12, 2010 @10:39PM
(#1785847)
In theory, you could use the same code provided you wrote it so that it would work independent of it's environment. Realistically, because server-side JavaScript and Node in particular is still new, most people haven't done that. For instance, on the client-side you're probably using XMLHttpRequest to pull in data via a web service. On the server side, you'd likely be fetching that data locally using a server-side library written for node. In that regard, you wouldn't be using the "same" code. However, you could (again, in theory) reuse domain objects and even libraries like YUI or jQuery to load, parse and traverse HTML as well as do server-side event handling as the YUI team has recently demonstrated. http://www.yuiblog.com/blog/2010/04/09/node-js-yui-3-dom-man... - There is a video that goes with that somewhere and I think it was linked on HN recently as well.
OT: Can someone refresh my memory on how to emphasize something on HN?