From cbc8e18ec1e7bd87c269ed625d48d05091cd0bc1 Mon Sep 17 00:00:00 2001 From: Matt Kirby <MattJKirby@outlook.com> Date: Sat, 15 Apr 2023 01:31:19 +0100 Subject: [PATCH] routes initalisation --- .../friend-service/src/Startup/routes.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 backend-services/friend-service/src/Startup/routes.ts diff --git a/backend-services/friend-service/src/Startup/routes.ts b/backend-services/friend-service/src/Startup/routes.ts new file mode 100644 index 00000000..846ca553 --- /dev/null +++ b/backend-services/friend-service/src/Startup/routes.ts @@ -0,0 +1,20 @@ +import express, { Application } from 'express' +import { authorize } from '../Middleware/Auth' +import { IndexRouter } from '../Routes' +import { FriendsRouter } from '../Routes/FriendsRouter' +import { RequestRouter } from '../Routes/RequestsRouter' + +/** + * Load the application endpoints + * @param app + */ +export const initializeRoutes = (app: Application) => { + app.use(express.json()) + + // load index routes + app.use('/', IndexRouter) + + //Other routes + app.use('/friends', authorize, FriendsRouter) + app.use('/friends/requests', authorize, RequestRouter) +} \ No newline at end of file -- GitLab