router index signature changed
This commit is contained in:
1 parent
872d686a1b
commit
ac99501dad
1 file changed
+10
-1
+10
-1
@@ -40,8 +40,17 @@ export function accepts(routes, def) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function index(filename = config['defaultIndex']) {
|
export function index(fn) {
|
||||||
|
let filename = config['defaultIndex'];
|
||||||
|
|
||||||
return function *() {
|
return function *() {
|
||||||
|
let test = true;
|
||||||
|
if(fn) test = yield fn();
|
||||||
|
|
||||||
|
if(!test) {
|
||||||
|
this.status = 404;
|
||||||
|
}
|
||||||
|
|
||||||
this.type = 'text/html';
|
this.type = 'text/html';
|
||||||
this.body = fs.createReadStream(filename);
|
this.body = fs.createReadStream(filename);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user