Converting js to node.js