now you can determine which is the last handler by checking if next function exists

This commit is contained in:
Alan Sikora
2016-04-11 00:00:18 -03:00
parent 6c25fced1c
commit 2453c11903
2 changed files with 6 additions and 2 deletions
+5 -1
View File
@@ -19,7 +19,11 @@ exports = module.exports = function initModules(app) {
handlers = []
} = config
instance[method.toLowerCase()](route, ...handlers)
const lastHandler = handlers.pop()
instance[method.toLowerCase()](route, ...handlers, async function(ctx) {
return await lastHandler(ctx)
})
app
.use(instance.routes())
+1 -1
View File
@@ -134,7 +134,7 @@ export async function getUser(ctx, next) {
ctx.throw(500)
}
next()
if(next) return next()
}
/**