Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

Commit

Permalink
Added shutdown functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
brollb committed May 15, 2015
1 parent f46f54f commit d9a1c19
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/server/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ var Server = function(opts) {

this._port = opts.port;
this._app = express();
this._serverInstance = null;
this.initializeApp(opts);
};

Expand Down Expand Up @@ -126,8 +127,12 @@ Server.prototype.splitCats = function(cats){

Server.prototype.start = function(callback) {
callback = callback || function(){};
this._app.listen(this._port, callback);
this._serverInstance = this._app.listen(this._port, callback);
console.log('App running on port', this._port);
};

Server.prototype.stop = function(callback) {
this._serverInstance.close(callback);
};

module.exports = Server;

0 comments on commit d9a1c19

Please sign in to comment.