Junior — Middle+
Creating a REST API for managing books: setting up routes
livecode
Task condition
The project includes a Spring controller named BookController responsible for book operations. It is required to:
- Define the base path
/api/booksfor all controller methods; - Configure individual endpoints according to REST conventions:
- Get a list of all books – HTTP GET;
- Get a book by its ID – HTTP GET with an ID parameter;
- Add a new book – HTTP POST;
- Update an existing book record – HTTP PUT;
- Delete a book – HTTP DELETE. It is necessary to follow REST naming conventions for paths and HTTP methods.