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

13 lines
228 B
JavaScript
Raw Normal View History

2016-09-11 20:38:52 +00:00
export default function apiWrapper(_options) {
return async function apiWrapperMiddleware(ctx, next) {
await next();
const success = ctx.status < 400;
ctx.body = {
...ctx.body,
success,
};
};
}