{"action":"created","issue":{"url":"https://api.github.com/repos/labstack/echo/issues/77","labels_url":"https://api.github.com/repos/labstack/echo/issues/77/labels{/name}","comments_url":"https://api.github.com/repos/labstack/echo/issues/77/comments","events_url":"https://api.github.com/repos/labstack/echo/issues/77/events","html_url":"https://github.com/labstack/echo/pull/77","id":78756491,"number":77,"title":"Added a Print function on router that prints routing paths","user":{"login":"markbates","id":3528,"avatar_url":"https://avatars.githubusercontent.com/u/3528?v=3","gravatar_id":"","url":"https://api.github.com/users/markbates","html_url":"https://github.com/markbates","followers_url":"https://api.github.com/users/markbates/followers","following_url":"https://api.github.com/users/markbates/following{/other_user}","gists_url":"https://api.github.com/users/markbates/gists{/gist_id}","starred_url":"https://api.github.com/users/markbates/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markbates/subscriptions","organizations_url":"https://api.github.com/users/markbates/orgs","repos_url":"https://api.github.com/users/markbates/repos","events_url":"https://api.github.com/users/markbates/events{/privacy}","received_events_url":"https://api.github.com/users/markbates/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-21T00:24:00Z","updated_at":"2015-05-29T17:37:05Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/labstack/echo/pulls/77","html_url":"https://github.com/labstack/echo/pull/77","diff_url":"https://github.com/labstack/echo/pull/77.diff","patch_url":"https://github.com/labstack/echo/pull/77.patch"},"body":"Very similar to using `rake routes` in Ruby on Rails, an application can use this print out a listing of the routes in their application.\r\n\r\nExample application:\r\n\r\n```go\r\npackage main\r\n\r\nimport (\r\n\t\"net/http\"\r\n\t\"os\"\r\n\r\n\t\"github.com/labstack/echo\"\r\n)\r\n\r\nfunc main() {\r\n\te := echo.New()\r\n\r\n\te.Get(\"/foo\", func(res http.ResponseWriter, req *http.Request) {})\r\n\te.Put(\"/foo\", func(res http.ResponseWriter, req *http.Request) {})\r\n\te.Get(\"/foo/:id\", func(res http.ResponseWriter, req *http.Request) {})\r\n\te.Get(\"/bar/baz/:id\", func(res http.ResponseWriter, req *http.Request) {})\r\n\te.Get(\"/:controller/:action/:id\", func(res http.ResponseWriter, req *http.Request) {})\r\n\r\n\tg := e.Group(\"/api/v1\")\r\n\tg.Get(\"/users/:id\", func(res http.ResponseWriter, req *http.Request) {})\r\n\tg.Get(\"/users/:id/edit\", func(res http.ResponseWriter, req *http.Request) {})\r\n\tg.Post(\"/users/:id\", func(res http.ResponseWriter, req *http.Request) {})\r\n\r\n\te.Router.Print(os.Stdout)\r\n}\r\n```\r\n\r\nExample output*: \r\n```\r\nGET\t/foo\r\n\t/foo/:id\r\n\t/bar/baz/:id\r\n\t/:controller/:action/:id\r\n\t/api/v1/users/:id\r\n\t/api/v1/users/:id/edit\r\nPOST\t/api/v1/users/:id\r\nPUT\t/foo\r\n```\r\n\r\n*please excuse the formatting on GitHub, it apparently doesn't care much for tabs."},"comment":{"url":"https://api.github.com/repos/labstack/echo/issues/comments/106882001","html_url":"https://github.com/labstack/echo/pull/77#issuecomment-106882001","issue_url":"https://api.github.com/repos/labstack/echo/issues/77","id":106882001,"user":{"login":"markbates","id":3528,"avatar_url":"https://avatars.githubusercontent.com/u/3528?v=3","gravatar_id":"","url":"https://api.github.com/users/markbates","html_url":"https://github.com/markbates","followers_url":"https://api.github.com/users/markbates/followers","following_url":"https://api.github.com/users/markbates/following{/other_user}","gists_url":"https://api.github.com/users/markbates/gists{/gist_id}","starred_url":"https://api.github.com/users/markbates/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markbates/subscriptions","organizations_url":"https://api.github.com/users/markbates/orgs","repos_url":"https://api.github.com/users/markbates/repos","events_url":"https://api.github.com/users/markbates/events{/privacy}","received_events_url":"https://api.github.com/users/markbates/received_events","type":"User","site_admin":false},"created_at":"2015-05-29T17:37:05Z","updated_at":"2015-05-29T17:37:05Z","body":"Ultimately it would be great to have access to a simple version of the route information, like I have above. An API to gain access to that would be great so people can build middleware, and other extensions around it. \r\n\r\nFor example, had there an API for routes I would've written a handler that would generate this type of print out. \r\n\r\nAnother example would be to build route helpers, like you'd find in frameworks such as Rails e.g. generate the final href string given the name of the route and parameter values. "}}