Closed ali-sattari closed 11 years ago
Scope isn't applied to before and after methods in Davis.Router, making it confusing for path specific calls.
This works:
app = Davis(function(){ this.scope('/myapp'); this.before('/myapp', function(req){ console.log('before /', req); }); this.get('/', function(req){ console.log('get /', req); }); });
While this should work:
app = Davis(function(){ this.scope('/myapp'); this.before('/', function(req){ console.log('before /', req); }); this.get('/', function(req){ console.log('get /', req); }); });
The issue can be solved by changing filter method of Davis.Router to add scope to the path when there is 2 arguments.
Good catch, I've just pushed a new version (0.9.4) of the library with a fix for this, thanks.
Scope isn't applied to before and after methods in Davis.Router, making it confusing for path specific calls.
This works:
While this should work:
The issue can be solved by changing filter method of Davis.Router to add scope to the path when there is 2 arguments.