2018-09-12 05:00:47 +01:00
|
|
|
module.exports = async (ctx, next) => {
|
|
|
|
|
await next();
|
|
|
|
|
if (ctx.request.path.startsWith('/api/')) {
|
2019-02-01 18:25:24 +08:00
|
|
|
return ctx.res.ok({
|
|
|
|
|
message: `request returned ${ctx.body.counter} ${ctx.body.counter > 1 ? 'routes' : 'route'}`,
|
|
|
|
|
data: ctx.body.result,
|
|
|
|
|
});
|
2018-09-12 05:00:47 +01:00
|
|
|
}
|
|
|
|
|
};
|