aboutsummaryrefslogtreecommitdiff
path: root/src/app.ts
diff options
context:
space:
mode:
authorjw2552018-04-15 17:24:10 +0100
committerjw2552018-04-15 17:24:10 +0100
commit1e6cb08fcdec54f1263eb1f6fdae6e0f438dfc97 (patch)
tree7133c67d68bf208948108ad04d0164d9936edeba /src/app.ts
parentMerge branch 'trh/gets' of gitlab.cs.st-andrews.ac.uk:cs3099group-be-4/projec... (diff)
downloadmedicine-1e6cb08fcdec54f1263eb1f6fdae6e0f438dfc97.tar.gz
medicine-1e6cb08fcdec54f1263eb1f6fdae6e0f438dfc97.zip

fixed logging

Diffstat (limited to 'src/app.ts')
-rw-r--r--src/app.ts18
1 files changed, 7 insertions, 11 deletions
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;
};