-
Notifications
You must be signed in to change notification settings - Fork 0
Scripts
The scripts/
folder stores the classes that ignites some part of the infrastructure of the cluster and have to be run inside the app.js
file.
You can call directly a script to start some pre-defined routine, and we encourage you to store your scripts there using the following skeleton:
var MyStartupClass = function(){
var exports = {};
var do = function(){
console.log("doing stuff..");
};
exports.do = do;
var init = function(){
return exports;
}
return init();
}
module.exports = new MyStartupClass();
And then use in your app.js file as:
var myStartupClass = require("./scripts/mystartupclass.js");
myStartupClass.do(); // will print "doing stuff" in the console
The class that encapsulates the Express HTTP Server and the Socket.io Server initialization. Cannot be called directly, for that you should use the Single Server script, described below:
Script for encapsulating the Server Script and start only one node of the Server. Can be called directly using node scripts/single-server
or npm run-script single-server
.
Script for starting the cluster using Forever module for app uptime improvement, starting it as a Daemon. Can be called directly using node scripts/deploy
or npm run-script deploy
.
Script for stopping all the cluster and its forks externalized by Forever module. Can be called directly using node scripts/stopall
or npm run-script stop
.
Script for encapsulating the Socket.io Server class. Not yet fully implemented.