From d9a1c196cd6e17d85c478f1144412e5281b52eab Mon Sep 17 00:00:00 2001 From: Brian Broll Date: Fri, 15 May 2015 07:53:27 -0500 Subject: [PATCH] Added shutdown functionality --- src/server/Server.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/server/Server.js b/src/server/Server.js index b968f5c..aa8766d 100644 --- a/src/server/Server.js +++ b/src/server/Server.js @@ -32,6 +32,7 @@ var Server = function(opts) { this._port = opts.port; this._app = express(); + this._serverInstance = null; this.initializeApp(opts); }; @@ -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;