node-httpx
Advanced tools
Comparing version 0.1.5 to 0.1.7
@@ -16,3 +16,2 @@ /* | ||
} | ||
this.internalConfig.httpServer = http.createServer(procedure); | ||
this.internalConfig.httpsPort = 443; | ||
@@ -22,2 +21,7 @@ if (config.httpsPort) { | ||
} | ||
this.internalConfig.httpsPort = 80; | ||
if (config.httpPort) { | ||
this.internalConfig.httpPort = config.httpPort; | ||
} | ||
this.internalConfig.httpServer = http.createServer(procedure); | ||
this.internalConfig.httpsServer = https.createServer(config, procedure); | ||
@@ -24,0 +28,0 @@ this.internalConfig.httpServer.timeout = 0; |
{ | ||
"name": "node-httpx", | ||
"version": "0.1.5", | ||
"version": "0.1.7", | ||
"description": "Provides a TLS-agnostic HTTP server and eliminates the redundancy in providing both secure and insecure servers.", | ||
@@ -5,0 +5,0 @@ "main": "httpx.js", |
@@ -95,3 +95,50 @@ # node-httpx | ||
## httpx.createServer | ||
``` | ||
httpx.createServer(config, function(req, res) { | ||
}); | ||
``` | ||
This follows the same general behavior as https.createServer. | ||
### httpx.createServer config | ||
This is the configuration object for this server. The following members are required: | ||
* key : this is the private key used for dealing with https requests. REQUIRED. | ||
* cert : this is the certificate used for dealing with https requests. REQUIRED. | ||
* httpPort : the port for http traffic. Default: 80. | ||
* httpsPort : the port for https traffic. defualt: 443. | ||
### httpx.createServer.listen | ||
``` | ||
workingServer.listen(); | ||
``` | ||
This starts the servers. Note that this feature is still being wrapped up. | ||
### httpx.createServer callback | ||
req is the request. res is the response. This callback is identical to what is found in node.http and node.https | ||
### httpx.createServer.close() | ||
``` | ||
workingServer.close(callback); | ||
``` | ||
This closes the http and https servers in this instance of an httpx server. Because of the http 1.1 and 2.0 specifications, this action is very prone to crashing. Use it at your own risk, and use it with a callback function. | ||
### httpx.createServer.setTimeout | ||
``` | ||
workingServer.setTimeout(time, callback); | ||
``` | ||
Calling this function changes this.timeout to time, sets the timeouts of the internal servers to time, and calls the callback function. | ||
## Specific Requests | ||
In addition to native request objects, node-httpx provides the request and get functions of the http and https modules. | ||
@@ -98,0 +145,0 @@ |
30145
168
230