From 80f5aeb37b3d997015238173499f4a067ec0c266 Mon Sep 17 00:00:00 2001 From: jw255 Date: Sat, 24 Feb 2018 19:34:20 +0000 Subject: tests now actually test what they are supposed to and catch errors if needed --- src/FileRouter.ts | 4 ++-- src/app.ts | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/FileRouter.ts b/src/FileRouter.ts index 34738bc..93a1e1a 100644 --- a/src/FileRouter.ts +++ b/src/FileRouter.ts @@ -524,8 +524,8 @@ export class FileRouter { * Initialize the FileRouter */ public constructor() { - this.router = Router(); - this.init(); + this.router = Router(); + this.init(); } /** diff --git a/src/app.ts b/src/app.ts index ef4485e..612ba49 100644 --- a/src/app.ts +++ b/src/app.ts @@ -33,8 +33,18 @@ class App { important : 'Endpoints start from /cs3099group-be-4/' }); }); - this.express.use('/', defRouter); + defRouter.get('/*', (req: ex.Request, res: ex.Response): void => { + res.status(404) + .json({ + status: 'error', + error : 'invalid_route', + error_description: 'Endpoints start from /cs3099group-be-4/\n' + +' Please refer to \'https://github.com/CS3099JH2017/cs3099jh/blob/master/protocols/BE01.md\'' + + ' for further details.' + }); + }) this.express.use('/cs3099group-be-4', FileRouter); + this.express.use('/', defRouter); } } -- cgit v1.2.1