summaryrefslogtreecommitdiffstats
path: root/lib/cli/server.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/cli/server.js')
-rw-r--r--lib/cli/server.js21
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/cli/server.js b/lib/cli/server.js
index 8d3d7ce..555bbb7 100644
--- a/lib/cli/server.js
+++ b/lib/cli/server.js
@@ -6,20 +6,28 @@ var url = require('url');
var Promise = require('../utils/promise');
-var Server = function() {
+function Server() {
this.running = null;
this.dir = null;
this.port = 0;
this.sockets = [];
-};
+}
util.inherits(Server, events.EventEmitter);
-// Return true if the server is running
+/**
+ Return true if the server is running
+
+ @return {Boolean}
+*/
Server.prototype.isRunning = function() {
return !!this.running;
};
-// Stop the server
+/**
+ Stop the server
+
+ @return {Promise}
+*/
Server.prototype.stop = function() {
var that = this;
if (!this.isRunning()) return Promise();
@@ -40,6 +48,11 @@ Server.prototype.stop = function() {
return d.promise;
};
+/**
+ Start the server
+
+ @return {Promise}
+*/
Server.prototype.start = function(dir, port) {
var that = this, pre = Promise();
port = port || 8004;