Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow http2 #82

Merged
merged 1 commit into from
Sep 18, 2023
Merged

allow http2 #82

merged 1 commit into from
Sep 18, 2023

Conversation

alexfriesen
Copy link
Contributor

This PR will allow passing createServer from node:http2. Additionally serverOptions will have more helpful types

@yusukebe
Copy link
Member

Hi @alexfriesen !

Good feature! Looks nice! Merging now!

@yusukebe yusukebe merged commit 2bf1f4d into honojs:main Sep 18, 2023
3 checks passed
@runspired
Copy link

Nice! I'd previously got http2 working like this:

import { serve } from '@hono/node-server';
import { Hono } from 'hono';
import http2 from 'node:http2';

// ...

  const app = new Hono();

  serve({
    fetch: app.fetch,
    createServer: (_, requestListener) => {
      return http2.createSecureServer(
        {
          key: fs.readFileSync(`${__dirname}/localhost-privkey.pem`),
          cert: fs.readFileSync(`${__dirname}/localhost-cert.pem`),
        },
        requestListener
      );
    },
    port: options.port ?? DEFAULT_PORT,
    hostname: 'localhost',
  });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants