rsnext/examples/with-http2
2020-09-06 00:08:20 +00:00
..
pages Update Examples for Fast Refresh (#13068) 2020-05-18 17:44:18 -04:00
.gitignore Added .gitignore to examples that are deployed to vercel (#15127) 2020-07-16 10:52:23 -04:00
next.config.js get the http2 example to work (#10470) 2020-02-09 23:05:53 -05:00
package.json Add cross-env to ensure examples work on Windows 10 (#16694) 2020-08-30 06:53:29 +00:00
README.md Undo unrequired readme changes done to examples (#16831) 2020-09-03 19:11:58 +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 or Yarn 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

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).