Router events (enabling route documentation) – feature request

Aperta
#4,523 3 commenti 5 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
express, javascript, node.js
Ambito
api, backend

Direzione di ricerca

Inizia esaminando la discussione dell’issue e il modulo di esempio mk-express-router-doc collegato per comprendere il router wrapper proposto e il comportamento degli eventi. Determina l’ambito e l’API degli eventi quando vengono aggiunti middleware, route o gestori di metodi, incluso se sono inclusi i metadati della documentazione delle route. Il lavoro è considerato completato quando è stata concordata una direzione di implementazione con la documentazione e i test corrispondenti, ma qui non vengono identificati file o test di destinazione.

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

Descrizione

future

I am very fond of the express router for it provides a great deal of flexibility. But I have somewhat problems keeping track of all the routes, middleware locations and methods.

It would be great if there was an event implementation that fires up, if e.g. a middleware handler, another route or a method handler is added.

It would then be easy to keep track of the routes and eventually build a documentation.

Since the lines above might not well explain what I have in mind, I have given this some more thought an created a little example module, which is basically a wrapper/decorator for the express router, which sort of mimics and extends the express router behavior.

I hope this example helps explaining why an evented router might be helpful indeed. It's not great code, but rather a quick and dirty hack:

https://github.com/mkastner/mk-express-router-doc

I don't want to be pushing this too far: but if one could add some documentation on the fly to each respective route and path – that would be the icing on the cake.

Lingua principale
JavaScript
Stelle
69.7k
Fork
25.6k
Merge medio
2g 9h
PR unite (30g)
4

Preparare l'ambiente

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.

Altre issue di expressjs/express

Tutte le issue di expressjs/express

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.