Skip to content

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

@khteh

Description

@khteh

Description

I previously used spdy for HTTP/2. However, due to spdy-http2/node-spdy#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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions