fix: home route weg
This commit is contained in:
		
							parent
							
								
									a3d40cf2bb
								
							
						
					
					
						commit
						a66952cc52
					
				
					 3 changed files with 0 additions and 60 deletions
				
			
		|  | @ -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(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -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<Translation>(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" }); | ||||
|     } | ||||
| } | ||||
|  | @ -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; | ||||
		Reference in a new issue
	
	 Gabriellvl
						Gabriellvl