rsnext/examples/with-http2
Luc Leray f52955ec94
Clean up examples package.json (#27121)
Clean up package.json files in the `examples` directory:
- Add `private: true`
- Remove `version` (because they are irrelevant for packages that are not meant to be published)
- Remove `name` (because they are optional for packages that are not meant to be published, and when someone clones an example, they often rename it and the property becomes stale)
- Remove `author`
- Remove `description`
- Remove `license`

Also remove `with-dynamic-app-layout` example completely, since it does the same as `layout-component` (https://github.com/vercel/next.js/pull/27121#discussion_r668178408).

## Documentation / Examples

- [x] Make sure the linting passes
2021-07-12 19:58:03 +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 Clean up examples package.json (#27121) 2021-07-12 19:58:03 +00:00
README.md Fix deploy buttons URLs (#20834) 2021-01-07 01:40:29 +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).