Time Table Routes
Overview
The timeTable.routes.js file defines the HTTP routes for the timetable service. It maps the routes to the corresponding controller functions and applies authorization middleware to protect the routes.
Dependencies
express: The web framework for Node.js../timeTable.controller.js: The controller functions for timetables.../../middleware/guards.js: The authorization middleware.
Routes
POST /: Creates a new timetable entry. Accessible toteacherandadminroles.GET /:id: Retrieves a single timetable entry by its ID. Accessible tostudent,teacher, andadminroles.GET /: Retrieves a list of all timetable entries. Accessible tostudent,teacher, andadminroles.PUT /:id: Updates an existing timetable entry by its ID. Accessible toteacherandadminroles.DELETE /:id: Deletes a timetable entry by its ID. Accessible toadminrole only.
Authorization
The isAuthorized middleware is used to protect the routes. It ensures that only users with the specified roles can access the routes.
Exports
router: The Express router for the timetable service.