I copy/pasted a node js hello world example into an html file
<html>
<head>
<script>
var http = require("http");
http.createServer(function (request, response) {
// Send the HTTP header
// HTTP Status: 200 : OK
// Content Type: text/plain
response.writeHead(200, {'Content-Type': 'text/plain'});
// Send the response body as "Hello World"
response.end('Hello World\n');
}).listen(8081);
// Console will print the message
console.log('Server running at http://127.0.0.1:8081/');
</script>
</head>
</html>
I'm using a Chrome app called OK 200! Server to make this page available at http://127.0.0.1:8887/ The ideal solution would work on a Google Chromebook.
When I run this it gives error:
Uncaught ReferenceError: require is not defined(…)
So that implies several features unique to node won't be embedded in Chrome. Is there an extension, chrome app, or native client app that would make those features available and still leverage the v8 engine already embedded in Chrome?