Rewrite of the node.js server code