From 484120ab50a05288f3b03072c5e25b7378a9f8d8 Mon Sep 17 00:00:00 2001 From: Gabriellvl Date: Sun, 2 Mar 2025 11:04:30 +0100 Subject: [PATCH] feat: extra learning object routes --- backend/src/routes/learningObjects.ts | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/backend/src/routes/learningObjects.ts b/backend/src/routes/learningObjects.ts index ec702c6d..42e72bca 100644 --- a/backend/src/routes/learningObjects.ts +++ b/backend/src/routes/learningObjects.ts @@ -1,14 +1,25 @@ import express from 'express'; -import { getAllLearningObjects } from '../controllers/learningObjects.js'; +import {getAllLearningObjects, getLearningObject} from '../controllers/learningObjects.js'; const router = express.Router(); // DWENGO learning objects -// Arg: hruid learningPath -// Query: language +// Queries: hruid(path), full, language // Route to fetch list of learning objects based on hruid of learning path -// Example: http://localhost:3000/learningObject/un_artificiele_intelligentie -router.get('/:hruid', getAllLearningObjects); + +// Route 1: list of object hruids +// Example 1: http://localhost:3000/learningObject?hruid=un_artificiele_intelligentie + +// Route 2: list of object data +// Example 2: http://localhost:3000/learningObject?full=true&hruid=un_artificiele_intelligentie +router.get('/', getAllLearningObjects); + + +// Parameter: hruid of learning object +// Query: language +// Route to fetch data of one learning object based on its hruid +// Example: http://localhost:3000/learningObject/un_ai7 +router.get('/:hruid', getLearningObject); export default router;