aboutsummaryrefslogtreecommitdiff
path: root/src/app.ts
diff options
context:
space:
mode:
authorHafeez2018-04-15 18:22:09 +0100
committerHafeez2018-04-15 18:22:09 +0100
commit42e30930b635eb91bdb97d0a889081cd291f3740 (patch)
treec355a2b8083f9f69beb0d424038e3460713f8b38 /src/app.ts
parentstarted modifying file upload (diff)
parentfixed fetching current_user (diff)
downloadmedicine-42e30930b635eb91bdb97d0a889081cd291f3740.tar.gz
medicine-42e30930b635eb91bdb97d0a889081cd291f3740.zip

Merge branch ‘trh/gets’ of gitlab.cs.st-andrews.ac.uk:cs3099group-be-4/project-code into trh/gets

Diffstat (limited to 'src/app.ts')
-rw-r--r--src/app.ts20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/app.ts b/src/app.ts
index 1d1c9cb..4dfeeda 100644
--- a/src/app.ts
+++ b/src/app.ts
@@ -77,7 +77,7 @@ class App {
.unless({path: [
'/',
'/cs3099group-be-4/oauth/token',
- '/cs3099group-be-4/_supported_protocols_'
+ '/cs3099group-be-4/_supported_protocols_'
] })
);
this.express.use(passport.initialize());
@@ -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;
};