This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
outline/server/api/middlewares/apiWrapper.js
2016-09-17 14:53:30 -07:00

14 lines
244 B
JavaScript

export default function apiWrapper(_options) {
return async function apiWrapperMiddleware(ctx, next) {
await next();
const ok = ctx.status < 400;
ctx.body = {
...ctx.body,
status: ctx.status,
ok,
};
};
}