diff options
| author | Tom Harley | 2018-03-01 22:06:42 +0000 |
|---|---|---|
| committer | Tom Harley | 2018-03-01 22:06:42 +0000 |
| commit | 10e00fba97f0227a7e3d61d2725326d4a5d37bfa (patch) | |
| tree | 52798af68f3e26e10c2b8554a56e73d0449ce9b5 /src/app.ts | |
| parent | Merge branch 'trh/linter' into trh/gets (diff) | |
| download | medicine-10e00fba97f0227a7e3d61d2725326d4a5d37bfa.tar.gz medicine-10e00fba97f0227a7e3d61d2725326d4a5d37bfa.zip | |
Add miniature response-wrapper middleware
Diffstat (limited to 'src/app.ts')
| -rw-r--r-- | src/app.ts | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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(); } |
