From 499a44cad7a137b62e6560201365fc3c60c83a93 Mon Sep 17 00:00:00 2001 From: Mathias Wagner <germannewsmaker@gmail.com> Date: Thu, 8 Sep 2022 22:30:03 +0200 Subject: [PATCH] Integrated the authentication middleware into the api server --- server/api.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/api.ts b/server/api.ts index d5ce16c..d8e62b8 100644 --- a/server/api.ts +++ b/server/api.ts @@ -2,9 +2,19 @@ import express, {Express} from 'express'; const app: Express = express(); +// Register the default middlewares app.use(express.json()); app.use(require('../api/middlewares/error')); +/** All routes that don't require authentication */ + + +// Register the authentication middleware +app.use(require('../api/middlewares/authenticate').authenticate); + +/** All routes that require authentication */ + + /** Logs something with an api prefix */ const log = (msg: string) => console.log(`[API] ${msg}`);