Creates and configures an Express router with exercise management routes.
This factory function initializes a complete Express router configuration for exercise-related operations,
including full CRUD operations for exercises and specialized endpoints for type-specific exercise filtering.
The function instantiates an ExerciseController with the provided PrismaClient and configures all routes
with appropriate middleware for authentication, authorization, validation, and error handling.
The returned router includes comprehensive exercise management capabilities supporting six different exercise
types (translation, fill-in-the-blank, true/false, pairs, informative, ordering) with type-specific data
validation and filtering. All routes implement comprehensive input validation using Zod schemas and
role-based access control to ensure proper content management permissions.
Parameters
prisma: PrismaClient
Prisma database client instance for controller initialization and database operations
Returns Router
Configured Express router with all exercise management endpoints
Throws
When PrismaClient initialization fails or database connection is unavailable
Example
// Basic usage in main application import { createExerciseRoutes } from'@/modules/content/routes/exerciseRoutes'; import { prisma } from'@/shared/database/connection';
Creates and configures an Express router with exercise management routes.
This factory function initializes a complete Express router configuration for exercise-related operations, including full CRUD operations for exercises and specialized endpoints for type-specific exercise filtering. The function instantiates an ExerciseController with the provided PrismaClient and configures all routes with appropriate middleware for authentication, authorization, validation, and error handling.
The returned router includes comprehensive exercise management capabilities supporting six different exercise types (translation, fill-in-the-blank, true/false, pairs, informative, ordering) with type-specific data validation and filtering. All routes implement comprehensive input validation using Zod schemas and role-based access control to ensure proper content management permissions.