GithubHelp home page GithubHelp logo

shubhamp-sf / loopback-http2-proxy Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 660 KB

HTTP2 proxy for loopback using two ways, native node:http2 and fastify http2 server.

TypeScript 100.00%
fastify http2 loopback loopback4 sourcefuse sourceloop

loopback-http2-proxy's Introduction

Checkout this blog for http2 support in lb4 app: https://blog.shubhamp.dev/how-to-use-http2-in-loopback-4-applications Related Thread: loopbackio/loopback-next#9067

http/2 proxy for loopback

Proxy code for forwarding HTTP2 requests to loopback, in two ways:

  1. Internal node:http2
  2. Fastify's http2 server
Check Out the Request Flow

Request Flow

image

Directory Structure

.
├── loopback-http2-proxy/ (• this repository)
│   └── src
│       ├── native-http2.ts
|           └── H2 Server having requests forwarded to lb4 app using node's internal http2.
│       └── fastify-http2.ts
|           └── H2 Server having requests forwarded to lb4 app using fastify.
└── default-app/ (loopback app to forward requests to)
    └── (...normal loopback app)

Changes required in Loopback App

TODO

Current Supoprt

  • GET routes with returned responses
  • GET routes with responses send() directly to http by loopback.
  • Translated http/1 Headers
  • Cookies
  • Status Codes
  • Static Responses (to support this.static('/', "index.html"))
  • Streamed Responses (Readable streams)
  • ...(more to come)

What has been tested?

An lb4 app sourced here is being used to test different routes and responses.

  • REST Controller with CRUD functions (Datasource: Postgres) source

    • @post('/users')
    • @get('/users')
    • @get('/users/count')
    • @patch('/users')
    • @get('/users/{id}')
    • @patch('/users/{id}')
    • @put('/users/{id}')
    • @del('/users/{id}')
  • Default Ping Controller

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.