Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow <anonymous> in STACK_ITEM_VALID_NAMES #63

Open
ahoward opened this issue Mar 30, 2021 · 2 comments · May be fixed by #90
Open

allow <anonymous> in STACK_ITEM_VALID_NAMES #63

ahoward opened this issue Mar 30, 2021 · 2 comments · May be fixed by #90
Assignees

Comments

@ahoward
Copy link

ahoward commented Mar 30, 2021

var STACK_ITEM_VALID_NAMES = [

locally i have

var STACK_ITEM_VALID_NAMES = [
  '<anonymous>',
  'router',
  'bound dispatch',
  'mounted_app'
]

and this seems to work perfectly. happy to put together a 1 line PR, but wondering if any reason to exclude these? in many apps not allowing app.use(path, router), which results in routes misses a big number of them.

@AlbertoFdzM
Copy link
Owner

Hi sorry about my delay to reply and thanks for paying attention to the project.

Can u provide an example of use to receive that <anonymous> value?

Like:

express = require('express')
app = express()

app.use('/bar', () => {})

console.log(app._router.stack[2]);

Do you think it would be useful? I mean, I didn't find any way to know which methods it exposes. Also, It would expose nonexistent endpoints, for example, if you are using a middleware attached to a route like this:

app.use('/api', jsonBodyParser)

That would be exposed as an endpoint although it's only a middleware and is not going to provide a response.

@webextensions
Copy link

webextensions commented Dec 16, 2023

Created PR #90 by adding includeMiddlewareRoutes as an optional configuration.

The potentially valid use-cases:

  • The handler might be registered via .use() because internally it has logic which handles multiple requests / request methods
  • The handler might be registered via .use() because it doesn't care about the request method (A collaborative project where the team members may not be following a strict standard)
  • The generated list is going to be utilized by developers for an overview of the project's architecture and it is helpful for its debugging nature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants