ac8a6035df
### What? If the custom server uses `app.render(xxx)` will render the normal js files as server components in dev mode and cause 404 error when loading every non-HTML file. ### How? Fixes https://github.com/nodejs/help/issues/4253, fixes https://github.com/vercel/next.js/issues/50270 |
||
---|---|---|
.. | ||
pages | ||
.gitignore | ||
next.config.js | ||
package.json | ||
README.md | ||
server.js |
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
yarn create next-app --example with-http2 with-http2-app
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).