Scanner Routes
Overview
The scanner.routes.js file defines the HTTP routes for the scanner 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../scanner.controller.js: The controller functions for scanners.../../middleware/guards.js: The authorization middleware.
Routes
POST /: Creates a new scanner. Accessible toadminrole only.GET /:id: Retrieves a single scanner by its ID. Accessible toadminandteacherroles.GET /: Retrieves a list of all scanners. Accessible toadminandteacherroles.PUT /:id: Updates an existing scanner by its ID. Accessible toadminrole only.DELETE /:id: Deletes a scanner 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 scanner service.