From 10e00fba97f0227a7e3d61d2725326d4a5d37bfa Mon Sep 17 00:00:00 2001 From: Tom Harley Date: Thu, 1 Mar 2018 22:06:42 +0000 Subject: Add miniature response-wrapper middleware --- src/app.ts | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/app.ts') 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 => { + res.json({ + status: 'success', + data: await res.locals.data + }); + } + ); this.errorware(); } -- cgit v1.2.1