aboutsummaryrefslogtreecommitdiff
path: root/src/app.ts
diff options
context:
space:
mode:
authorTom Harley2018-03-01 22:06:42 +0000
committerTom Harley2018-03-01 22:06:42 +0000
commit10e00fba97f0227a7e3d61d2725326d4a5d37bfa (patch)
tree52798af68f3e26e10c2b8554a56e73d0449ce9b5 /src/app.ts
parentMerge branch 'trh/linter' into trh/gets (diff)
downloadmedicine-10e00fba97f0227a7e3d61d2725326d4a5d37bfa.tar.gz
medicine-10e00fba97f0227a7e3d61d2725326d4a5d37bfa.zip

Add miniature response-wrapper middleware

Diffstat (limited to 'src/app.ts')
-rw-r--r--src/app.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/app.ts b/src/app.ts
index 86b0c1c..28b97a7 100644
--- a/src/app.ts
+++ b/src/app.ts
@@ -18,6 +18,15 @@ class App {
this.precondition();
this.middleware();
this.mountRoutes();
+ this.express.use(
+ async(req: ex.Request, res: ex.Response, next: ex.NextFunction):
+ Promise<void> => {
+ res.json({
+ status: 'success',
+ data: await res.locals.data
+ });
+ }
+ );
this.errorware();
}