expressjs / expressjs/express

Router events (enabling route documentation) – feature request

Open
#4,523 3 comments 5 reactions 0 assignees View on GitHub
future
Dominant language
JavaScript
Stars
69.5k
Forks
25k
Avg merge
4d 20h
Merged PRs (30d)
9

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.