Run a function as a separate node.js process?

Is it possible to run a function as a completely separate node.js process? For instance:

var parallel = require("parallel");
parallel(function(){
    var app = require("express")();
    app.on("/",function(req,res){ res.send("hi"); });
    app.listen(80);
},function callback(err,stdout){
    console.log("process terminated!")
});

Is something like this possible?

+5
source share
2 answers

First of all, try using the idiomatic way of balancing the load. For node, this is an asynchronous design. See Other Answers for more information:

There are options:

+1
0

All Articles