From a66952cc52ba601b42324beaabe0b60f08fecb68 Mon Sep 17 00:00:00 2001 From: Gabriellvl Date: Sat, 1 Mar 2025 22:19:25 +0100 Subject: [PATCH] fix: home route weg --- backend/src/app.ts | 4 ---- backend/src/controllers/home.ts | 41 --------------------------------- backend/src/routes/home.ts | 15 ------------ 3 files changed, 60 deletions(-) delete mode 100644 backend/src/controllers/home.ts delete mode 100644 backend/src/routes/home.ts diff --git a/backend/src/app.ts b/backend/src/app.ts index b0a889a6..b0f7afa2 100644 --- a/backend/src/app.ts +++ b/backend/src/app.ts @@ -12,8 +12,6 @@ import classRouter from './routes/class'; import questionRouter from './routes/question'; import loginRouter from './routes/login'; -import homeRouter from './routes/home.js'; - const app: Express = express(); const port: string | number = getNumericEnvVar(EnvVars.Port); @@ -35,8 +33,6 @@ app.use('/login', loginRouter); app.use('/theme', themeRoutes); -app.use('/home', homeRouter); - async function startServer() { await initORM(); diff --git a/backend/src/controllers/home.ts b/backend/src/controllers/home.ts deleted file mode 100644 index 6324b854..00000000 --- a/backend/src/controllers/home.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { Request, Response } from 'express'; -import { loadTranslations } from '../util/translationHelper.js'; - -const BASE_IMAGE_URL = "https://www.dwengo.org/images/strengths/"; - -interface Translation { - strengths: { - title: string; - innovative: string; - research_based: string; - inclusive: string; - socially_relevant: string; - main: string; - }; -} - -export function getHomeScreenData(req: Request, res: Response): void { - try { - const language = (req.query.language as string) || 'nl'; - const translations = loadTranslations(language); - - const strengths = [ - { key: "innovative", image: "value-innovation.png" }, - { key: "research_based", image: "value-research.png" }, - { key: "inclusive", image: "value-inclusion.png" }, - { key: "socially_relevant", image: "value-society.png" }, - ].map(({ key, image }) => ({ - title: translations.strengths[key as keyof Translation["strengths"]], - image: `${BASE_IMAGE_URL}${image}` - })); - - res.json({ - title: translations.strengths.title, - description: translations.strengths.main, - strengths - }); - } catch (error) { - console.error("❌ Error getting data for homescreen:", error); - res.status(500).json({ error: "Internal server error" }); - } -} diff --git a/backend/src/routes/home.ts b/backend/src/routes/home.ts deleted file mode 100644 index 19dc8b38..00000000 --- a/backend/src/routes/home.ts +++ /dev/null @@ -1,15 +0,0 @@ -import express from 'express'; -import { getHomeScreenData } from '../controllers/home.js'; - -const router = express.Router(); - -/** - * @route GET /api/home - * @query {string} language - Taalcode (bijv. 'nl' of 'fr') - * @returns JSON object with homepage data (strengths) - * @example http://localhost:3000/home - * {title, description, strengths: {title, image}} - */ -router.get('/', getHomeScreenData); - -export default router;