From 1e6cb08fcdec54f1263eb1f6fdae6e0f438dfc97 Mon Sep 17 00:00:00 2001 From: jw255 Date: Sun, 15 Apr 2018 17:24:10 +0100 Subject: fixed logging --- src/app.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src/app.ts') diff --git a/src/app.ts b/src/app.ts index 1d1c9cb..e9d1d68 100644 --- a/src/app.ts +++ b/src/app.ts @@ -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; }; -- cgit v1.2.1