{"action":"closed","issue":{"url":"https://api.github.com/repos/vuejs/vue-router/issues/399","repository_url":"https://api.github.com/repos/vuejs/vue-router","labels_url":"https://api.github.com/repos/vuejs/vue-router/issues/399/labels{/name}","comments_url":"https://api.github.com/repos/vuejs/vue-router/issues/399/comments","events_url":"https://api.github.com/repos/vuejs/vue-router/issues/399/events","html_url":"https://github.com/vuejs/vue-router/issues/399","id":139112892,"number":399,"title":"Router middleware","user":{"login":"nblackburn","id":2931085,"avatar_url":"https://avatars.githubusercontent.com/u/2931085?v=3","gravatar_id":"","url":"https://api.github.com/users/nblackburn","html_url":"https://github.com/nblackburn","followers_url":"https://api.github.com/users/nblackburn/followers","following_url":"https://api.github.com/users/nblackburn/following{/other_user}","gists_url":"https://api.github.com/users/nblackburn/gists{/gist_id}","starred_url":"https://api.github.com/users/nblackburn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nblackburn/subscriptions","organizations_url":"https://api.github.com/users/nblackburn/orgs","repos_url":"https://api.github.com/users/nblackburn/repos","events_url":"https://api.github.com/users/nblackburn/events{/privacy}","received_events_url":"https://api.github.com/users/nblackburn/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-07T22:23:39Z","updated_at":"2016-03-08T00:27:10Z","closed_at":"2016-03-08T00:27:10Z","body":"I was wondering if it would be better to depreciate `router.beforeEach` and `router.afterEach` in favor of route middleware like what is possible in recent versions of vuex.\r\n\r\n```javascript\r\nimport auth from 'router/middleware';\r\n\r\nmiddleware: [\r\n    auth()\r\n]\r\n```\r\n\r\n```javascript\r\nexport default {\r\n    handle(request, next) {\r\n        // before middleware\r\n        let response = next();\r\n        // after middleware\r\n    },\r\n};\r\n```\r\n\r\nTo me this feels more graceful but i could well be wrong."}}