diff options
| author | jw255 | 2018-04-15 17:24:10 +0100 |
|---|---|---|
| committer | jw255 | 2018-04-15 17:24:10 +0100 |
| commit | 1e6cb08fcdec54f1263eb1f6fdae6e0f438dfc97 (patch) | |
| tree | 7133c67d68bf208948108ad04d0164d9936edeba /src/app.ts | |
| parent | Merge branch 'trh/gets' of gitlab.cs.st-andrews.ac.uk:cs3099group-be-4/projec... (diff) | |
| download | medicine-1e6cb08fcdec54f1263eb1f6fdae6e0f438dfc97.tar.gz medicine-1e6cb08fcdec54f1263eb1f6fdae6e0f438dfc97.zip | |
fixed logging
Diffstat (limited to 'src/app.ts')
| -rw-r--r-- | src/app.ts | 18 |
1 files changed, 7 insertions, 11 deletions
@@ -110,26 +110,22 @@ class App { message: 'Welcome to the CS3099 BE4 server!', important: 'Endpoints start from /cs3099group-be-4/' }); - }); - //const errRouter: ex.Router = ex.Router(); - + }); this.express.use('/cs3099group-be-4', FileRouter); this.express.use('/cs3099group-be-4', authRouter); - this.express.use('/', defRouter); - this.express.use((req: ex.Request, res: ex.Response, next: ex.NextFunction): void => { - console.log(res.locals) + this.express.use('/', defRouter); + this.express.use((req: ex.Request, res: ex.Response, + next: ex.NextFunction): void => { if (Object.keys(res.locals).length === 0) { - console.log(404) res.status(404) .json({ status: 'error', error : 'invalid_route', error_description: 'Endpoints start from /cs3099group-be-4/' }); + } else { + next(); } - else { - next(); - } }); } @@ -149,5 +145,5 @@ export default new App(true).express; */ // tslint:disable-next-line:variable-name export const TestApp: () => ex.Express = (): ex.Express => { - return new App(false).express; + return new App(true).express; }; |
