Skip to content

Commit 20555d4

Browse files
committed
feat: update net TypeScript declarations
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 3590e0f commit 20555d4

File tree

1 file changed

+55
-2
lines changed

1 file changed

+55
-2
lines changed

lib/node_modules/@stdlib/net/docs/types/index.d.ts

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
import tempHttpServer = require( '@stdlib/net/disposable-http-server' );
2424
import httpServer = require( '@stdlib/net/http-server' );
25+
import http2SecureServer = require( '@stdlib/net/http2-secure-server' );
2526
import simpleHttpServer = require( '@stdlib/net/simple-http-server' );
2627

2728
/**
@@ -62,6 +63,10 @@ interface Namespace {
6263
/**
6364
* Returns a function which creates an HTTP server.
6465
*
66+
* ## Notes
67+
*
68+
* - In addition to options documented below, the function supports any options supported by `http.createServer`. Which server options are supported depends on the Node.js version. Older Node.js versions (e.g., <= v8.12.0) do not support an options object when calling `http.createServer`, and, for those versions, any options supported by `http.createServer` in later Node.js versions are ignored.
69+
*
6570
* @param options - server options
6671
* @param options.port - server port (default: 0)
6772
* @param options.maxport - max server port
@@ -76,7 +81,7 @@ interface Namespace {
7681
* 'port': 7331,
7782
* 'address': '0.0.0.0'
7883
* };
79-
* var createServer = ns.httpServer( opts );
84+
* var ns.httpServer = ns.httpServer( opts );
8085
*
8186
* @example
8287
* var opts = {
@@ -87,10 +92,58 @@ interface Namespace {
8792
* console.log( request.url );
8893
* response.end( 'OK' );
8994
* }
90-
* var createServer = ns.httpServer( opts, onRequest );
95+
* var ns.httpServer = ns.httpServer( opts, onRequest );
9196
*/
9297
httpServer: typeof httpServer;
9398

99+
/**
100+
* Returns a function which creates an HTTP/2 server.
101+
*
102+
* ## Notes
103+
*
104+
* - The function requires that either the PFX option is provided or a cert/key pair is provided.
105+
* - In addition to options documented below, the function supports any options supported by `http2.createSecureServer`. Which server options are supported depends on the Node.js version.
106+
*
107+
* @param options - server options
108+
* @param options.port - server port (default: 0)
109+
* @param options.maxport - max server port
110+
* @param options.hostname - server hostname
111+
* @param options.address - server address (default: '127.0.0.1')
112+
* @param options.pfx - PFX or PKCS12 encoded private key and certificate chain
113+
* @param options.cert - cert chains in PEM format
114+
* @param options.key - private keys in PEM format
115+
* @param requestListener - callback invoked upon receiving an HTTP request
116+
* @throws must provide valid options
117+
* @returns function which creates an HTTP/2 server
118+
*
119+
* @example
120+
* var readFileSync = require( '@stdlib/fs/read-file' ).sync;
121+
*
122+
* var opts = {
123+
* 'port': 7331,
124+
* 'address': '0.0.0.0',
125+
* 'cert': readFileSync( './path/to/cert.pem' ),
126+
* 'key': readFileSync( './path/to/key.pem' )
127+
* };
128+
* var http2Server = ns.http2SecureServer( opts );
129+
*
130+
* @example
131+
* var readFileSync = require( '@stdlib/fs/read-file' ).sync;
132+
*
133+
* var opts = {
134+
* 'port': 7331,
135+
* 'address': '0.0.0.0',
136+
* 'cert': readFileSync( './path/to/cert.pem' ),
137+
* 'key': readFileSync( './path/to/key.pem' )
138+
* };
139+
* function onRequest( request, response ) {
140+
* console.log( request.url );
141+
* response.end( 'OK' );
142+
* }
143+
* var http2Server = ns.http2SecureServer( opts, onRequest );
144+
*/
145+
http2SecureServer: typeof http2SecureServer;
146+
94147
/**
95148
* Creates a simple HTTP server. The implementation takes inspiration from Python's [SimpleHTTPServer][python-simplehttpserver].
96149
*

0 commit comments

Comments
 (0)