rsnext/examples/with-http2
2022-07-26 20:08:40 -05:00
..
pages Update Examples for Fast Refresh (#13068) 2020-05-18 17:44:18 -04:00
.gitignore Update default gitignore templates (#39051) 2022-07-26 20:08:40 -05:00
next.config.js get the http2 example to work (#10470) 2020-02-09 23:05:53 -05:00
package.json Remove licence from all example/package.json that has them (#28007) 2021-08-14 10:48:39 -05:00
README.md Update pnpm create next-app for latest pnpm 6 and 7 (#37254) 2022-05-27 21:21:40 +00:00
server.js Remove path specific switch statement from http2 example (#16558) 2020-09-06 00:08:20 +00:00

HTTP2 server example

This example shows the most basic example using an HTTP2 server. We have 2 pages: pages/index.js and pages/about.js. The former responds to / requests and the latter to /about. Using next/link you can add hyperlinks between them with universal routing capabilities.

How to use

Execute create-next-app with npm, Yarn, or pnpm to bootstrap the example:

npx create-next-app --example with-http2 with-http2-app
# or
yarn create next-app --example with-http2 with-http2-app
# or
pnpm create next-app --example with-http2 with-http2-app

Create the public and private keys:

openssl req -x509 -newkey rsa:2048 -nodes -sha256 -subj '/CN=localhost' \
  -keyout localhost-privkey.pem -out localhost-cert.pem

Deploy it to the cloud with Vercel (Documentation).