Node.js sample rewrite