You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+39-35Lines changed: 39 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,45 +5,45 @@ Create an http AND/OR an https server and call the same request handler.
5
5
## Usage
6
6
7
7
The `create-servers` module exports a function that takes a config object and
8
-
a node-style callback. The config object must have at minimum an `http` or
8
+
a node-style callback. The config object must have at minimum an `http` or
9
9
`https` property (or both). The following config properties are supported:
10
10
11
-
| Property | Description |
12
-
|---------------------------|-------------|
13
-
|`handler`| Request handler to be used for any server, unless overridden specifically with `http.handler` or `https.handler`. |
14
-
|`timeout`| Socket timeout in milliseconds for any server, unless overridden with `http.timeout` or `https.timeout`. Defaults to the node default of 2 minutes. |
15
-
|`http`| Optional. If present, an HTTP server is started. This can be an object or a number. If it's a number, it's used as the TCP port for an HTTP server. |
16
-
|`http.port`| TCP port for the HTTP server. Defaults to `80`. |
17
-
|`http.host`| The address the HTTP server is bound to. Defaults to `::` or `0.0.0.0`. |
18
-
|`http.timeout`| Socket timeout in milliseconds for the server. If unspecified, the top-level `timeout` configuration is used. |
19
-
|`http.handler`| Handler for HTTP requests. If you want to share a handler with all servers, use a top-level `handler` config property instead. |
20
-
|`https`| Optional object. If present, an HTTPS server is started. |
21
-
|`https.port`| TCP port for the HTTPS server. Defaults to `443`. |
22
-
|`https.host`| The address the HTTPS server is bound to. Defaults to `::` or `0.0.0.0`. |
23
-
|`https.timeout`| Socket timeout in milliseconds for the server. If unspecified, the top-level `timeout` configuration is used. |
24
-
|`https.ciphers`| Defaults to a [default cipher suite](#note-on-security). To customize, either supply a colon-separated string or array of strings for the ciphers you want the server to support. |
25
-
|`https.honorCipherOrder`| If true, prefer the server's specified cipher order instead of the client's. Defaults to `false`. |
26
-
|`https.root`| Root directory for certificate/key files. See [Certificate normalization](#certificate-normalization) for more details. |
27
-
|`https.key`| PEM/file path for the server's private key. See [Certificate normalization](#certificate-normalization) for more details. |
28
-
|`https.cert`| PEM/file path(s) for the server's certificate. See [Certificate normalization](#certificate-normalization) for more details. |
29
-
|`https.ca`| Cert or array of certs specifying trusted authorities for peer certificates. Only required if your server accepts client certificate connections signed by authorities that are not trusted by default. See [Certificate normalization](#certificate-normalization) for more details. |
30
-
|`https.sni`| See [SNI Support](#sni-support). |
31
-
|`https.handler`| Handler for HTTPS requests. If you want to share a handler with all servers, use a top-level `handler` config property instead. |
32
-
|`https.*`| Any other properties supported by [https.createServer](https://nodejs.org/dist/latest-v8.x/docs/api/https.html#https_https_createserver_options_requestlistener) can be added to the https object, except `secureProtocol` and `secureOptions` which are set to recommended values. |
|`handler`| Request handler to be used for any server, unless overridden specifically with `http.handler` or `https.handler`.|
14
+
|`timeout`| Socket timeout in milliseconds for any server, unless overridden with `http.timeout` or `https.timeout`. Defaults to the node default of 2 minutes. |
15
+
|`http`| Optional. If present, an HTTP server is started. This can be an object or a number. If it's a number, it's used as the TCP port for an HTTP server. You may also use an Array to start multiple servers. |
16
+
|`http.port`| TCP port for the HTTP server. Defaults to `80`.|
17
+
|`http.host`| The address the HTTP server is bound to. Defaults to `::` or `0.0.0.0`.|
18
+
|`http.timeout`| Socket timeout in milliseconds for the server. If unspecified, the top-level `timeout` configuration is used.|
19
+
|`http.handler`| Handler for HTTP requests. If you want to share a handler with all servers, use a top-level `handler` config property instead.|
20
+
|`https`| Optional object. If present, an HTTPS server is started. You may start multiple HTTPS servers by passing an array of objects |
21
+
|`https.port`| TCP port for the HTTPS server. Defaults to `443`.|
22
+
|`https.host`| The address the HTTPS server is bound to. Defaults to `::` or `0.0.0.0`.|
23
+
|`https.timeout`| Socket timeout in milliseconds for the server. If unspecified, the top-level `timeout` configuration is used.|
24
+
|`https.ciphers`| Defaults to a [default cipher suite](#note-on-security). To customize, either supply a colon-separated string or array of strings for the ciphers you want the server to support.|
25
+
|`https.honorCipherOrder`| If true, prefer the server's specified cipher order instead of the client's. Defaults to `false`.|
26
+
|`https.root`| Root directory for certificate/key files. See [Certificate normalization](#certificate-normalization) for more details.|
27
+
|`https.key`| PEM/file path for the server's private key. See [Certificate normalization](#certificate-normalization) for more details.|
28
+
|`https.cert`| PEM/file path(s) for the server's certificate. See [Certificate normalization](#certificate-normalization) for more details.|
29
+
|`https.ca`| Cert or array of certs specifying trusted authorities for peer certificates. Only required if your server accepts client certificate connections signed by authorities that are not trusted by default. See [Certificate normalization](#certificate-normalization) for more details. |
30
+
|`https.sni`| See [SNI Support](#sni-support).|
31
+
|`https.handler`| Handler for HTTPS requests. If you want to share a handler with all servers, use a top-level `handler` config property instead.|
32
+
|`https.*`| Any other properties supported by [https.createServer](https://nodejs.org/dist/latest-v8.x/docs/api/https.html#https_https_createserver_options_requestlistener) can be added to the https object, except `secureProtocol` and `secureOptions` which are set to recommended values.|
33
33
34
34
If successful, the `create-servers` callback is passed an object with the
35
35
following properties:
36
36
37
-
| Property | Description |
38
-
|----------|-------------|
39
-
|`http`| The HTTP server that was created, if any |
40
-
|`https`| The HTTPS server that was created, if any |
0 commit comments