make the node.js sample work on Windows

Also, beautify the code, fix some jshint's findings and add package.json.