I am taking my first steps with Node.js and I was wondering whether there is some way to invoke a JS method define server-side (using Node.js) but from the client side. e.g.
function read_file_server_side(id){
// Do stuff on the server side.
}
and then, from the client side we need to be able to invoke the method. Of course, I understand that it is possible to wrap the server-side method using REST principles; i.e. expose it to the client as a web service and have the clients using HTTP requests. But it comes handy if one could make use of the function directly.
Instead of socket.io, I’d rather point you to Now.js. It does exactly what you want : share functions server side on the client side.