swagger-server icon indicating copy to clipboard operation
swagger-server copied to clipboard

get all possible GET, POST ... routes?

Open balazsnemeth opened this issue 9 years ago • 4 comments

Is it possible to list all of the POST, GET ... routes?

balazsnemeth avatar May 26 '16 14:05 balazsnemeth

You mean like an endpoint that you'd go to that would return a list of all the routes as plain-text?

JamesMessinger avatar May 26 '16 14:05 JamesMessinger

Thanks for the quick response!

I would like to override all of my posts, here how I'm overriding one:

 server.post('/path', function(req, res, next) {
    res.json(success); 
  });

Is is possible to override all POST? Is it possible to get the 'path' of all registered POST requests?

(I just don't want to manually type all of my POST path-es)

balazsnemeth avatar May 26 '16 14:05 balazsnemeth

Ah, I see what you mean. You want to be able to dynamically add your own middleware based on the endpoints that are in the Swagger definition.

Swagger Server doesn't currently expose that information to you. Although, I like the idea of exposing it, so I'm totally going to add that to the to-do list. But, in the meantime, you can use Swagger Parser (which Swagger Server uses internally) yourself to get that info, and then add your middleware accordingly.

JamesMessinger avatar May 26 '16 15:05 JamesMessinger

Exactly, thanks for adding this to the TODO list.

balazsnemeth avatar May 27 '16 09:05 balazsnemeth