[JITERA] Add Author Routes for CRUD Operations
Overview
This pull request introduces new routes for managing authors in the application. The routes allow for the creation, retrieval, updating, and deletion of author records.
Changes
-
Added Author Routes:
- Implemented routes for creating, reading, updating, and deleting authors in
src/routes/authorRoutes.js. - The routes include:
-
POST /authors: Create a new author. -
GET /authors: Retrieve a list of all authors. -
GET /authors/:id: Retrieve a specific author by ID. -
PUT /authors/:id: Update an existing author by ID. -
DELETE /authors/:id: Delete an author by ID.
-
- Implemented routes for creating, reading, updating, and deleting authors in
-
Controller Integration:
- Integrated the routes with the corresponding controller functions to handle the business logic for each operation.
-
Validation:
- Added basic validation for author data to ensure that required fields are provided when creating or updating an author.
-
Error Handling:
- Implemented error handling to return appropriate HTTP status codes and messages for various scenarios (e.g., not found, validation errors).
-
Testing:
- Added unit tests for the new routes to ensure they function as expected.
This enhancement will facilitate better management of authors within the application and improve the overall functionality.