loopbackio / loopbackio/loopback-next

How to build a new API transport extension (or migrate a LB3 one)

Offen
#5,425 2 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Docs epic Extensions Migration
Vorherrschende Sprache
TypeScript
Sterne
5.1k
Forks
1.1k
Ø Merge
2 T. 21 Std.
Gemergte PRs (30 T.)
27

Beschreibung

This story is extracted from #4099, where we researched existing LoopBack 3 components and various techniques they use.

Now we need to write documentation for extension authors to show how to solve the following use cases in LoopBack 4:

  1. A new server type to handle requests coming from a non-REST source, e.g. Primus/WebSockets and RabbitMQ.

  2. WebSockets: mount WebSocket-handler on the underlying http server used by @loopback/rest.

  3. Message queues: allow consumers to also produce (publish) new messages, e.g. as a response to the incoming message.

Prior work:

I see the following major areas to cover (feel free to add more items to this list):

  • How can a transport implementation discover endpoint handlers (controllers, routes, message consumers, etc.) registered in the application context? (Related: How can extensions introspect application artifacts #5426)
    • Also how to handle handlers added dynamically after application has started
  • How should be a transport extension structured like?
    • Ensure that app.start() will start the server/subscriber, app.stop() stop it
    • How to create a per-request context and populate it with request-specific metadata

In most cases, the new content will be useful to authors building new LB4 components too, therefore we should structure the content in two parts:

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Lies zuerst die vorhandene Dokumentation zu Creating servers und prüfe anschließend die Leitfäden Extending LoopBack 4 und Migrating components and extensions. Behandle Komponentendienste, die Erkennung von Transport-Handlern, dynamische Handler, das Starten und Stoppen der Anwendung sowie den anfragebezogenen Kontext für WebSockets und Message Queues. Als abgeschlossen gilt die Arbeit, wenn beide Leitfäden die aufgeführten Anwendungsfälle und die migrationsspezifischen Aspekte klar erläutern.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
node.js, typescript
Bereich
backend-api-design, documentation
Issue-Typ
Dokumentation
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
28/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.