Your task is to implement simple CRUD API using a simple in-memory data structure.
-
Create a Flask application that allows users to perform CRUD (Create, Read, Update, Delete) operations on a list of books. The application should have the following routes:
- GET /books: This route should return a list of all books.
- GET /books/:id: This route should return the details of a specific book identified by its ID.
- POST /books: This route should allow users to add a new book to the list.
- PUT /books/:id: This route should allow users to update the details of a specific book identified by its ID.
- DELETE /books/:id: This route should allow users to delete a specific book identified by its ID.
-
The book details should include the following attributes.
- id - unique identifier (uuid, required) generated on server side
- title - book's title (string, required)
- author - book's auther name (string, required)
- price - book's price (int, required)
- category - book's category (array of strings, required)
- publication_year - date and year of the book's publicaiton (date, required)
-
Requests to non-existing endpoints (e.g. /some-non/existing/resource) should be handled.
-
Internal server errors should be handled and processed correctly.
-
Make sure the api is accesible by frontend apps hosted on a different domain (cross-site resource sharing)