5 Building Block View - maex0/SoftwareQualityWithCats GitHub Wiki
The following building block view shows the building blocks of SoftwareQualityWithCats and their interactions. It is created with the dependency-cruiser tool.
Dependency/Component Diagram
Backend API
The backend API is responsible for fetching cat images from the database and TheCatApi, as well as saving new cat images to the database. It consists of the following components:
URL | Method | Description | Request Body | Response |
---|---|---|---|---|
/api/catimageshandler |
GET | Fetches a list of cat images from the database, ordered by creation date in descending order. The number of images fetched is determined by the MAX_LIKED_CAT_IMAGES environment variable, with a default of 3. |
None | An array of cat images, or an error message if fetching fails. |
/api/catimageshandler |
POST | Attempts to save a new cat image to the database. If a cat image with the same ID already exists, it returns a 409 status code with an error message. | A CatImage object. |
The saved CatImage object, or an error message if saving fails. |
/api/catimageshandler |
Others | Returns a 405 status code and sets the 'Allow' header to 'GET, POST'. | None | None |
/api/getrandomcatimage |
GET | Fetches a random cat image from TheCatAPI. The image is small, in JPG format, does not have any associated breeds, and is ordered randomly. | None | A CatImage object, or an error message if fetching fails. |
/api/getrandomcatimage |
Others | Returns a 405 status code and sets the 'Allow' header to 'GET'. | None | None |
/api/healthcheck |
GET | Returns the health status of the application, including the uptime, a status message, and the current timestamp. | None | A JSON object with the keys status , uptime , message , and timestamp . |
/api/healthcheck |
Others | Returns a 405 status code and sets the 'Allow' header to 'GET'. | None | None |