fix: DELETE en POST endpoints toegevoegd
This commit is contained in:
		
							parent
							
								
									400a955850
								
							
						
					
					
						commit
						8c7d5e965c
					
				
					 6 changed files with 17 additions and 5 deletions
				
			
		
							
								
								
									
										8
									
								
								backend/config.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								backend/config.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| // Can be placed in dotenv but found it redundant
 | ||||
| // Import dotenv from "dotenv";
 | ||||
| // Load .env file
 | ||||
| // Dotenv.config();
 | ||||
| export const DWENGO_API_BASE = 'https://dwengo.org/backend/api'; | ||||
| export const FALLBACK_LANG = 'nl'; | ||||
| export const FALLBACK_SEQ_NUM = 1; | ||||
| 
 | ||||
|  | @ -6,6 +6,7 @@ import learningPathRoutes from './routes/learning-paths.js'; | |||
| import learningObjectRoutes from './routes/learning-objects.js'; | ||||
| 
 | ||||
| import studentRouter from './routes/students.js'; | ||||
| import teacherRouter from './routes/teachers.js'; | ||||
| import groupRouter from './routes/groups.js'; | ||||
| import assignmentRouter from './routes/assignments.js'; | ||||
| import submissionRouter from './routes/submissions.js'; | ||||
|  | @ -38,6 +39,7 @@ app.get('/', (_, res: Response) => { | |||
| }); | ||||
| 
 | ||||
| app.use('/student', studentRouter); | ||||
| app.use('/teacher', teacherRouter); | ||||
| app.use('/group', groupRouter); | ||||
| app.use('/assignment', assignmentRouter); | ||||
| app.use('/submission', submissionRouter); | ||||
|  |  | |||
|  | @ -26,7 +26,7 @@ export async function createAssignmentHandler(req: Request<AssignmentParams>, re | |||
| 
 | ||||
|     if (!assignmentData.description || !assignmentData.language || !assignmentData.learningPath || !assignmentData.title) { | ||||
|         res.status(400).json({ | ||||
|             error: 'Missing one or more required fields: title, description, learningPath, title', | ||||
|             error: 'Missing one or more required fields: title, description, learningPath, language', | ||||
|         }); | ||||
|         return; | ||||
|     } | ||||
|  |  | |||
|  | @ -2,6 +2,7 @@ import { Request, Response } from 'express'; | |||
| import { | ||||
|     createStudent, | ||||
|     deleteStudent, | ||||
|     getAllStudents, | ||||
|     getStudent, | ||||
|     getStudentAssignments, | ||||
|     getStudentClasses, | ||||
|  | @ -143,6 +144,3 @@ export async function getStudentSubmissionsHandler(req: Request, res: Response): | |||
|         submissions: submissions, | ||||
|     }); | ||||
| } | ||||
| function getAllStudents(): StudentDTO[] | string[] | PromiseLike<StudentDTO[] | string[]> { | ||||
|     throw new Error('Function not implemented.'); | ||||
| } | ||||
|  |  | |||
|  | @ -17,6 +17,8 @@ router.get('/', getAllStudentsHandler); | |||
| 
 | ||||
| router.post('/', createStudentHandler); | ||||
| 
 | ||||
| router.delete('/', deleteStudentHandler); | ||||
| 
 | ||||
| router.delete('/:username', deleteStudentHandler); | ||||
| 
 | ||||
| // Information about a student's profile
 | ||||
|  |  | |||
|  | @ -15,6 +15,8 @@ router.get('/', getAllTeachersHandler); | |||
| 
 | ||||
| router.post('/', createTeacherHandler); | ||||
| 
 | ||||
| router.delete('/', deleteTeacherHandler); | ||||
| 
 | ||||
| router.get('/:username', getTeacherHandler); | ||||
| 
 | ||||
| router.delete('/:username', deleteTeacherHandler); | ||||
|  |  | |||
		Reference in a new issue
	
	 Adriaan Jacquet
						Adriaan Jacquet