diff --git a/backend/src/controllers/student.ts b/backend/src/controllers/student.ts index 5892a84f..911d6ac9 100644 --- a/backend/src/controllers/student.ts +++ b/backend/src/controllers/student.ts @@ -44,3 +44,13 @@ export const createStudent: RequestHandler = async (req, res, next) => { next(error); } }; + +export const getAllStudents: RequestHandler = async (_, res, next) => { + try { + const students = await StudentModel.find(); + + res.status(200).json(students); + } catch (error) { + next(error); + } +}; diff --git a/backend/src/routes/.keep b/backend/src/routes/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/backend/src/routes/student.ts b/backend/src/routes/student.ts index 918f9452..f1713f64 100644 --- a/backend/src/routes/student.ts +++ b/backend/src/routes/student.ts @@ -11,4 +11,6 @@ const router = express.Router(); router.post("/", StudentValidator.createStudent, StudentController.createStudent); +router.get("/all", StudentController.getAllStudents); + export default router;