zeanium-node
Advanced tools
Comparing version 0.6.48 to 0.7.0
{ | ||
"name": "zeanium-node", | ||
"version": "0.6.48", | ||
"version": "0.7.0", | ||
"description": "Zeanium for Node.js, simple http server and custome your business.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -8,2 +8,3 @@ /** | ||
'node:http', | ||
'node:https', | ||
'node:path' | ||
@@ -14,2 +15,3 @@ ],function ( | ||
node_http, | ||
node_https, | ||
node_path | ||
@@ -33,3 +35,3 @@ ) { | ||
this.__initNodePaths(_config); | ||
this.__createHttpServer(_config.port, _config.host); | ||
this.__createHttpServer(_config); | ||
this.__createHttpServerContext(_config); | ||
@@ -60,9 +62,14 @@ }, | ||
}, | ||
__createHttpServer: function (port, host){ | ||
var _httpServer = new node_http.Server(); | ||
_httpServer.addListener('request', this.__onRequest.bind(this)); | ||
_httpServer.addListener("connection", this.__onConnection.bind(this)); | ||
_httpServer.addListener("close", this.__onClose.bind(this)); | ||
_httpServer.listen(port, host); | ||
return _httpServer; | ||
__createHttpServer: function (config){ | ||
var _server = null; | ||
if(config.https){ | ||
_server = new node_https.Server(config.https); | ||
}else { | ||
_server = new node_http.Server(config.http||{}); | ||
} | ||
_server.addListener('request', this.__onRequest.bind(this)); | ||
_server.addListener("connection", this.__onConnection.bind(this)); | ||
_server.addListener("close", this.__onClose.bind(this)); | ||
_server.listen(config.port, config.host); | ||
return _server; | ||
}, | ||
@@ -69,0 +76,0 @@ __createHttpServerContext: function (config){ |
@@ -263,3 +263,3 @@ /** | ||
__getURL: function (host, port){ | ||
return 'http://' + host + ":" + port; | ||
return (this._config.https?'https':'http') + '://' + host + ":" + port; | ||
} | ||
@@ -266,0 +266,0 @@ } |
272021
6301