A simple shot on how to implement http2 with nodejs
This project is an attempt to simplify the process to create a server http2 with node. If you have any knowledge who could improve this repository or enlight me, please feel free to share it with issues.
Since http2 protocol is not working with the current state of Express, spdy
appears to be the solution to use http2 over Express. You will have to wait Express v5 if you do not want to use spdy to get http2 with Express. You still can use the http2 protocol if you do not need Express.
Source Github - Doesn't work with Express.js
However, just to note, spdy is dead. Chrome no longer supports it. I disabled support for it in Firefox 50 (scheduled to release in 12 weeks or so), and removed it entirely in Firefox 51 (6 weeks or so after 50). It is not compatible with h2, even if it was the basis for the spec work, so no, spdy is not a good option for anyone.
If I ever get more than a few hours to work on this repo, I might actually try to make this work with Express since it's obviously a pain point for a lot of people, but I don't see any time soon when that would happen. Until that, patches are more than welcome to fix the issue.
npm i # Will install dependencies
npm start # Will start the server
npm dev # Will start the server - in dev mod
If you have installed the project, you want to run npm run cert
.
It will create a configs
folder with three files in it :
- server.crt : which is the certificate to authenticate
- server.csr : wich i do not know what it is right now
- server.key : wich is the private key to sign up the certificate (you must keep it safe)