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

Is there a way to generate a "sitemap" of a REST API? #129

Closed
tleyden opened this issue Oct 20, 2015 · 8 comments
Closed

Is there a way to generate a "sitemap" of a REST API? #129

tleyden opened this issue Oct 20, 2015 · 8 comments

Comments

@tleyden
Copy link

tleyden commented Oct 20, 2015

I have a REST api defined with Gorrillamux, and want to show a hierarchical view of the entire REST api in HTML. Does Gorillamux provide any API calls that would make that relatively easy?

@derekdowling
Copy link

Even just being able to do this for debugging via fmt.Printf("% v", router.Tree()) would be super helpful when dealing with subrouters.

@elithrar
Copy link
Contributor

elithrar commented Nov 6, 2015

You can use Router.Walk for this with a Router.WalkFunc to walk through the URLs (and then build a map/slice of structs with the results).

@elico
Copy link

elico commented Jan 11, 2016

@elithrar I have tried to use the Walk function to print the list of pathes which the router handles but something is wrong, every single route have an empty name: https://gist.github.com/elico/170b4d98b52b1da58d56
Am I doing something wrong?

@nicowernli
Copy link

You have to add the name to the routes if you want to get it later using the Name() method

@elico
Copy link

elico commented Jan 11, 2016

@nicowernli OK, from the code I was suspecting that this is what I would be required to do.
Isn't there any other way to get the route path?matcher without setting the name??
What would be the right way to use a Walk function to achieve that? I tried to see in godoc.org but have not found an example or some way I could understand to do so.

@nicowernli
Copy link

I'm sory @elico, I'v been reading the source code and it looks like you can't access the path but not 100% sure

@elico
Copy link

elico commented Jan 11, 2016

@nicowernli @elithrar I am thinking about patching the source and to add a getMatchers to kind of solve the issue.

@elithrar
Copy link
Contributor

Refer to #104 for an upcoming approach for addressing this.

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

No branches or pull requests

5 participants