{"action":"opened","issue":{"url":"https://api.github.com/repos/orangemug/isorouter/issues/16","repository_url":"https://api.github.com/repos/orangemug/isorouter","labels_url":"https://api.github.com/repos/orangemug/isorouter/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/orangemug/isorouter/issues/16/comments","events_url":"https://api.github.com/repos/orangemug/isorouter/issues/16/events","html_url":"https://github.com/orangemug/isorouter/issues/16","id":163132898,"number":16,"title":"Distinguish between middleware and handlers which respond","user":{"login":"oliverbrooks","id":17350,"avatar_url":"https://avatars.githubusercontent.com/u/17350?v=3","gravatar_id":"","url":"https://api.github.com/users/oliverbrooks","html_url":"https://github.com/oliverbrooks","followers_url":"https://api.github.com/users/oliverbrooks/followers","following_url":"https://api.github.com/users/oliverbrooks/following{/other_user}","gists_url":"https://api.github.com/users/oliverbrooks/gists{/gist_id}","starred_url":"https://api.github.com/users/oliverbrooks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oliverbrooks/subscriptions","organizations_url":"https://api.github.com/users/oliverbrooks/orgs","repos_url":"https://api.github.com/users/oliverbrooks/repos","events_url":"https://api.github.com/users/oliverbrooks/events{/privacy}","received_events_url":"https://api.github.com/users/oliverbrooks/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-06-30T10:28:59Z","updated_at":"2016-06-30T10:28:59Z","closed_at":null,"body":"Use case:\r\n\r\nI have an app in which some routes are only relevant on the server. When I do a GET or POST to these routes I want the request to perform a full HTTP request rather than attempt an XHR and 404. \r\n\r\nThis is currently possible by using a fully qualified URL which isorouter treats as a full page refresh but it requires knowledge that route x needs this special treatment.\r\n\r\nWould propose that the route matching return `false` if there is no handler which matches the given pathname. For example.\r\n\r\nisomorphic_routes.js\r\n```\r\nisorouter.use(middleware1);\r\nisorouter.use(middleware2);\r\n\r\nisorouter.get(\"/fish\", function () {});\r\n```\r\n\r\nserver_routes.js\r\n```\r\nrouter.get(\"/face\", function () {});\r\n```\r\n\r\nIf you hit this app with `GET /fish` it will run middleware 1 and 2 and also the fish handler and do so on both client and server side.\r\n\r\nIf you hit this app with `GET /face' with HTTP it will handle the request but fail from a loaded client app. If you tap a link to `/face` it will run through the middleware and fail silently. Sad face.\r\n\r\nWould be nice if isorouter could detect that there is no handler for a pathname matching the link `<a href=\"/face\">` and perform a HTTP request. \r\n\r\nIn the current code this would involve returning `false` to `router.go()` called from `lib/dom_event_listener.js` so the event isn't cancelled.  This could be done by modifying the `go` method in `browser.js` to only return true if there was one or more route match (ignore middleware)."}}
{"actor":{"display_login":"oliverbrooks"}}