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

Print all routes #227

Closed
skolos opened this issue Apr 7, 2014 · 7 comments · Fixed by #243
Closed

Print all routes #227

skolos opened this issue Apr 7, 2014 · 7 comments · Fixed by #243

Comments

@skolos
Copy link

skolos commented Apr 7, 2014

For debugging purposes I'd like to print all routes. This is especially should be useful when Groups are used. I could not locate this functionality anywhere in the code. Maybe I am missing something obvious.

Thanks

@erizocosmico
Copy link
Member

Add this after that line: https://github.com/go-martini/martini/blob/master/router.go#L140

fmt.Println(pattern)

@losinggeneration
Copy link

This might be a good one-off solution. IMO a better solution might be to print that whenever the environment is != production.

-- Edit
@mvader I'm surprised you didn't mention pull #76 as a possible solution. Additionally, issue #63 would "fix" this as well.

@erizocosmico
Copy link
Member

Not everyone might want all routes to be printed when they’re not in production. Let’s see what @codegangsta thinks about this.

On 14 de abril de 2014 at 17:08:51, Harley Laue (notifications@github.com) wrote:

This might be a good one-off solution. IMO a better solution might be to print that whenever the environment is != production.


Reply to this email directly or view it on GitHub.

-- 
José M. Molina
Sent with Airmail

@losinggeneration
Copy link

You're right. I will say though, I did like that Dropwizard printed the routes upon starting (I don't recall if they do that unconditionally though.) Rails also has a utility to print all routes as well IIRC. So it's not an uncommon feature and can be quite valuable to verify your routes.

@codegangsta
Copy link
Contributor

I can see Martini enabling this kind of behavior via extension. That way it is an opt in rather than a feature forced on users. What does the API need in order to print routes?

Sent from my iPhone

On Apr 14, 2014, at 8:32 AM, Harley Laue notifications@github.com wrote:

You're right. I will say though, I did like that Dropwizard printed the routes upon starting (I don't recall if they do that unconditionally though.) Rails also has a utility to print all routes as well IIRC. So it's not an uncommon feature and can be quite valuable to verify your routes.


Reply to this email directly or view it on GitHub.

@losinggeneration
Copy link

I can't speak for others, but perhaps a method to return an array of structs containing the method & original pattern?

--edit
This is potentially unfortunate because it would have to flatten groups as well.

@codegangsta
Copy link
Contributor

Yeah. I think that is a good idea. The Routes middleware should be able to
support something like that

On Mon, Apr 14, 2014 at 8:58 AM, Harley Laue notifications@github.comwrote:

I can't speak for others, but perhaps a method to return an array of
structs containing the method & original pattern?


Reply to this email directly or view it on GitHubhttps://github.com//issues/227#issuecomment-40383594
.

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

Successfully merging a pull request may close this issue.

4 participants