Enable open-in-browser in the Game Of Life example (#69)

This commit is contained in:
Prince Mathew
2018-04-07 22:31:10 +05:30
committed by Daniel Wirtz
parent b7ef21950b
commit 89e8de5d82
4 changed files with 29 additions and 1 deletions

View File

@ -0,0 +1,18 @@
var open = require('opn');
var http = require('http');
var fs = require('fs');
const PORT = 9080;
fs.readFile('./game-of-life.html', function (err, html) {
if (err) throw err;
http.createServer(function(request, response) {
response.writeHeader(200, {"Content-Type": "text/html"});
response.write(html);
response.end();
}).listen(PORT);
});
open('http://localhost:9080/game-of-life.html');