fix: queries in routes van leer paden
This commit is contained in:
		
							parent
							
								
									3b689d8e09
								
							
						
					
					
						commit
						6bf4193da9
					
				
					 1 changed files with 17 additions and 23 deletions
				
			
		|  | @ -1,33 +1,27 @@ | ||||||
| import express from 'express'; | import express from 'express'; | ||||||
| import { | import { getLearningPaths } from '../controllers/learningPaths.js'; | ||||||
|     getLearningPaths, |  | ||||||
|     getLearningPathsByTheme, |  | ||||||
|     searchLearningPaths, |  | ||||||
| } from '../controllers/learningPaths.js'; |  | ||||||
| 
 | 
 | ||||||
| const router = express.Router(); | const router = express.Router(); | ||||||
| 
 | 
 | ||||||
| // DWENGO learning paths
 | // DWENGO learning paths
 | ||||||
| 
 | 
 | ||||||
| // Unified route for fetching learning paths
 | // Route 1: no query
 | ||||||
| // Route 1: Query: hruid (list), language
 |  | ||||||
| // Fetch learning paths based on hruid list
 |  | ||||||
| // Example 1: http://localhost:3000/learningPath?hruids=pn_werking&hruids=art1
 |  | ||||||
| 
 |  | ||||||
| // Route 2: no query
 |  | ||||||
| // Fetch all learning paths
 | // Fetch all learning paths
 | ||||||
| // Example 2: http://localhost:3000/learningPath (
 | // Example 1: http://localhost:3000/learningPath
 | ||||||
|  | 
 | ||||||
|  | // Unified route for fetching learning paths
 | ||||||
|  | // Route 2: Query: hruid (list), language
 | ||||||
|  | // Fetch learning paths based on hruid list
 | ||||||
|  | // Example 2: http://localhost:3000/learningPath?hruid=pn_werking&hruid=art1
 | ||||||
|  | 
 | ||||||
|  | // Query: search, language
 | ||||||
|  | // Route to fetch learning paths based on a searchterm
 | ||||||
|  | // Example 3: http://localhost:3000/learningPath?search=robot
 | ||||||
|  | 
 | ||||||
|  | // Query: theme, anguage
 | ||||||
|  | // Route to fetch learning paths based on a theme
 | ||||||
|  | // Example: http://localhost:3000/learningPath?theme=kiks
 | ||||||
|  | 
 | ||||||
| router.get('/', getLearningPaths); | router.get('/', getLearningPaths); | ||||||
| 
 | 
 | ||||||
| // Query: language
 |  | ||||||
| // Route to fetch learning paths based on a searchterm
 |  | ||||||
| // Example: http://localhost:3000/learningPath/search?query=robot
 |  | ||||||
| router.get('/search', searchLearningPaths); |  | ||||||
| 
 |  | ||||||
| // Arg: theme id
 |  | ||||||
| // Query: language
 |  | ||||||
| // Route to fetch learning paths based on a theme
 |  | ||||||
| // Example: http://localhost:3000/learningPath/theme/kiks
 |  | ||||||
| router.get('/theme/:theme', getLearningPathsByTheme); |  | ||||||
| 
 |  | ||||||
| export default router; | export default router; | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 Gabriellvl
						Gabriellvl