{"action":"created","issue":{"url":"https://api.github.com/repos/gorilla/muxy/issues/1","labels_url":"https://api.github.com/repos/gorilla/muxy/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/gorilla/muxy/issues/1/comments","events_url":"https://api.github.com/repos/gorilla/muxy/issues/1/events","html_url":"https://github.com/gorilla/muxy/issues/1","id":113337262,"number":1,"title":"Discussion: Top-Level Router API","user":{"login":"elithrar","id":18544,"avatar_url":"https://avatars.githubusercontent.com/u/18544?v=3","gravatar_id":"","url":"https://api.github.com/users/elithrar","html_url":"https://github.com/elithrar","followers_url":"https://api.github.com/users/elithrar/followers","following_url":"https://api.github.com/users/elithrar/following{/other_user}","gists_url":"https://api.github.com/users/elithrar/gists{/gist_id}","starred_url":"https://api.github.com/users/elithrar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elithrar/subscriptions","organizations_url":"https://api.github.com/users/elithrar/orgs","repos_url":"https://api.github.com/users/elithrar/repos","events_url":"https://api.github.com/users/elithrar/events{/privacy}","received_events_url":"https://api.github.com/users/elithrar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-10-26T11:38:59Z","updated_at":"2015-10-26T23:24:39Z","closed_at":null,"body":"Might as well start this to pick up where https://github.com/gorilla/mux/issues/130 leaves off.\r\n\r\nSome high-level comments:\r\n\r\n* `func (r *Route) Handler(handler http.HandlerFunc, methods ...string) *Route` should accept a `http.Handler` and have a sister method `HandleFunc` that accepts a `http.HandleFunc`.\r\n* Not sure where this puts the `Get`, `Head`, etc. convenience methods—additional methods for these would clutter the API.\r\n* Should `router.Sub` return a `*Router` instead, allowing you to use the same methods as you would on a `*Router`? `prefix` could be a field of Router that the call to `router.Sub` sets.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/gorilla/muxy/issues/comments/151312684","html_url":"https://github.com/gorilla/muxy/issues/1#issuecomment-151312684","issue_url":"https://api.github.com/repos/gorilla/muxy/issues/1","id":151312684,"user":{"login":"moraes","id":3164,"avatar_url":"https://avatars.githubusercontent.com/u/3164?v=3","gravatar_id":"","url":"https://api.github.com/users/moraes","html_url":"https://github.com/moraes","followers_url":"https://api.github.com/users/moraes/followers","following_url":"https://api.github.com/users/moraes/following{/other_user}","gists_url":"https://api.github.com/users/moraes/gists{/gist_id}","starred_url":"https://api.github.com/users/moraes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moraes/subscriptions","organizations_url":"https://api.github.com/users/moraes/orgs","repos_url":"https://api.github.com/users/moraes/repos","events_url":"https://api.github.com/users/moraes/events{/privacy}","received_events_url":"https://api.github.com/users/moraes/received_events","type":"User","site_admin":false},"created_at":"2015-10-26T23:24:39Z","updated_at":"2015-10-26T23:24:39Z","body":"@elithrar: The name Subrouter in this initial proposal is a bit misleading, because it is not doing any nested dispatch, nor it's merging routes from one router into another. It is just a convenience to register URL's that share a common prefix (a domain and/or path). It's dumb but kinda lovely.\r\n\r\nTo achieve what you want, we would need something different. For example, package1 defines a router:\r\n\r\n```go\r\nr := mux.New()\r\nr.Route(\"/bar\").Handler(barHandler)\r\n```\r\n\r\nAnd package2 imports it and submounts it under a given prefix:\r\n\r\n```go\r\nr := mux.New()\r\nr.Mount(prefix, package1.r)\r\n``` \r\n\r\nIn the end, only package2's router would know how to build the URLs that are being served, though.\r\n"}}