[JITERA] Add Search Module for Books
Created by: chi-jitera
Overview
This pull request introduces a search module for finding books based on various criteria such as title, author, or genre. The changes include the implementation of a search function in the service layer, a new endpoint in the controller, and the necessary routing to support this functionality.
Changes
-
Add Search Functionality in
bookService.js:- Implemented a new function that allows searching for books based on title, author, or genre. This function queries the book database and returns matching results.
-
Add Search Endpoint in
bookController.js:- Created a new endpoint that handles incoming search requests. This endpoint utilizes the search function from
bookService.jsto process the search criteria and return the results to the client.
- Created a new endpoint that handles incoming search requests. This endpoint utilizes the search function from
-
Define Search Route in
bookRoutes.js:- Added a new route that maps to the search endpoint in the controller. This route will handle GET requests for searching books.
-
Update
server.jsto Include Search Functionality:- No changes were needed in
server.jsas it already includes the routes frombookRoutes.js. The new search route will be automatically included.
- No changes were needed in
These changes enhance the book module by allowing users to search for books using various criteria, improving the overall user experience.