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

Fixes issue when no routes are matched Router.prototype.use with no URL will not work #163

Closed
wants to merge 1 commit into from

Conversation

divmgl
Copy link

@divmgl divmgl commented Aug 13, 2015

Addresses issue #161

@kudos
Copy link

kudos commented Sep 2, 2015

@alexmingoia Any sign of this getting merged? Looks like if no routes are explicitly matched the router's middleware does not get called.

@divmgl
Copy link
Author

divmgl commented Sep 5, 2015

After further investigation, the OP of issue #161 is doing something incorrectly because his code actually works in the master branch. However, as @kudos mentioned, if no routes are explicitly matched no other middleware gets called. This pull request will allow for configurations like this:

var serve = require('koa-static');
var router = new require('koa-router')();

router.use(serve('/../public'));

[
  '/customer',
  '/customer/:id'
].forEach(function(route){
  router.use(rewrite(route, "/"));
});

app.use(router.middleware());
app.listen(80);

@divmgl divmgl changed the title Fixed issue where calling Router.prototype.use with no URL will not work Fixes issue when no routes are matched Router.prototype.use with no URL will not work Sep 5, 2015
@alexmingoia
Copy link
Collaborator

This should be fixed in 5.2.1 please confirm.

@kudos
Copy link

kudos commented Oct 2, 2015

Fixed for me in 5.2.1. Thanks!

@alexmingoia alexmingoia closed this Oct 3, 2015
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 this pull request may close these issues.

3 participants