We are planning to implement http2 in a loopback 4 application. We had used http, socket servers but never http2.
What is the procedure to use http2 in my application?
We are planning to implement http2 in a loopback 4 application. We had used http, socket servers but never http2.
What is the procedure to use http2 in my application?
Here's what you have to do in your existing app:
Step 1: Install spdy
Step 2: Configure
index.tsChange your main function in
src/index.tswith this:All we're doing in the above code is, preventing the default http server from being started and starting the server using spdy with loopback's request handler
app.requestHandlerthat will be used for all incoming request.To generate certificate and keys for localhost use:
You may need to allow self-signed certificates in Chrome as well for
/explorerto work as expected.And that's it, you can now run your app, and enjoy the power of http2 :)
Blog Post: https://shubham-web.medium.com/how-to-use-http2-in-loopback-4-applications-5e83881c7b38