function createSecureServer
Usage in Deno
```typescript import { createSecureServer } from "node:node__http2.d.ts"; ```
createSecureServer(onRequestHandler?: (request: Http2ServerRequest,response: Http2ServerResponse,) => void): Http2SecureServer
Returns a `tls.Server` instance that creates and manages `Http2Session` instances.
```js
import http2 from 'node:http2';
import fs from 'node:fs';
const options = {
key: fs.readFileSync('server-key.pem'),
cert: fs.readFileSync('server-cert.pem'),
};
// Create a secure HTTP/2 server
const server = http2.createSecureServer(options);
server.on('stream', (stream, headers) => {
stream.respond({
'content-type': 'text/html; charset=utf-8',
':status': 200,
});
stream.end('
Hello World
'); }); server.listen(8443); ```optional
onRequestHandler: (request: Http2ServerRequest,response: Http2ServerResponse,) => void
See `Compatibility API`
createSecureServer<Http1Request extends IncomingMessage = IncomingMessage,Http1Response extends ServerResponse = ServerResponse,Http2Request extends Http2ServerRequest = Http2ServerRequest,Http2Response extends Http2ServerResponse = Http2ServerResponse,>(options: SecureServerOptions<Http1Request, Http1Response, Http2Request, Http2Response>,onRequestHandler?: (request: InstanceType<Http2Request>,response: InstanceType<Http2Response>,) => void,): Http2SecureServer<Http1Request, Http1Response, Http2Request, Http2Response>
Http1Request extends IncomingMessage = IncomingMessage
Http1Response extends ServerResponse = ServerResponse
Http2Request extends Http2ServerRequest = Http2ServerRequest
Http2Response extends Http2ServerResponse = Http2ServerResponse
optional
onRequestHandler: (request: InstanceType<Http2Request>,response: InstanceType<Http2Response>,) => void