loopbackio / loopbackio/loopback-next

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

Aperta
#5,425 2 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Docs epic Extensions Migration
Lingua principale
TypeScript
Stelle
5.1k
Fork
1.1k
Merge medio
2g 21h
PR unite (30g)
27

Descrizione

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:

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Leggi prima la documentazione esistente su Creating servers, quindi esamina le guide Extending LoopBack 4 e Migrating components and extensions. Tratta i servizi dei componenti, l’individuazione degli handler di trasporto, gli handler dinamici, l’avvio e l’arresto dell’applicazione e il contesto per richiesta per WebSockets e le code di messaggi. Il lavoro è completato quando entrambe le guide spiegano chiaramente i casi d’uso elencati e gli aspetti specifici della migrazione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
node.js, typescript
Ambito
backend-api-design, documentation
Tipo di issue
Documentazione
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
28/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.