Make the example code demonstrate forked process and dynamic require

This commit is contained in:
Lorenz Gardner
2015-01-05 17:58:57 -06:00
parent a1405a3b36
commit cf97acfcdb
2 changed files with 24 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
var nexe = require('nexe');
nexe.compile(
{
input: "./index.js",
output: "./hellowWord.exe",
nodeVersion: "0.10.33",
nodeTempDir: "",
flags: true
},
function (err) {
if (err) {
console.log(err);
}
}
);
+8
View File
@@ -3,6 +3,14 @@ fs = require("fs"),
path = require("path"),
port = 1337;
//Fork a new process to execute the broser.js
var childProc = require("child_process");
childProc.fork("./browser.js");
if (false) {
require("./browser.js"); //force the bundler to include the .js file
}
//start a web server on specified port (or default if non given)
console.log("started HTTP server on port %d", port = Number(process.argv.concat().pop()) || port);
http.createServer(function(req, res) {