expressjs / expressjs/express

How to use Express server with `http2.createSecureServer` for HTTP/2?

Open
#6,863 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
69.5k
Forks
25k
Avg merge
4d 20h
Merged PRs (30d)
9

Description

### Description

I previously used spdy for HTTP/2. However, due to https://github.com/spdy-http2/node-spdy/issues/403 and the repo is inactive, I would like to consider using node native HTTP/2 but there are some caveats. The `express` app uses a lot of interfaces which work with other third-party libraries like `app.use`, `app.set`, `app.enable` in order to use view engines, setting the views and static artifacts folder, etc. How to achieve this using the `http2.createSecureServer`? I don't see that in https://nodejs.org/api/http2.html

### Minimal Reproduction

```
import fs from 'fs';
import { app } from './index.js';
import http2 from 'http2';

const options = {
key: fs.readFileSync('server.key'),
cert: fs.readFileSync('server.crt')
};

app.set('port', port);
const server = http2.createSecureServer(options, app);
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.