2022-01-25 02:12:09 +03:00
|
|
|
# 🐾 catApi
|
2022-01-25 16:00:54 +03:00
|
|
|
|
2025-02-10 05:32:28 +03:00
|
|
|
catApi is a minimal, self-hostable API (and frontend) for serving pictures of...
|
|
|
|
you guessed, it cats! Who doesn't like cats?
|
2022-01-25 02:12:09 +03:00
|
|
|
|
2025-02-10 05:32:28 +03:00
|
|
|
## API Documentation
|
2022-01-25 02:12:09 +03:00
|
|
|
|
2025-02-10 05:32:28 +03:00
|
|
|
There are several API endpoints that you may query.
|
2022-01-25 02:12:09 +03:00
|
|
|
|
2025-02-10 05:32:28 +03:00
|
|
|
### `/api/id`
|
2022-01-25 02:12:09 +03:00
|
|
|
|
2023-10-27 10:48:26 +03:00
|
|
|
`/api/id` will return the image with the associated ID.
|
2022-01-25 02:12:09 +03:00
|
|
|
|
2025-02-10 05:32:28 +03:00
|
|
|
For example **`http://localhost:3000/api/id?id=3`** will return the image with
|
|
|
|
the ID of "3".
|
2022-01-25 02:12:09 +03:00
|
|
|
|
2025-02-10 05:32:28 +03:00
|
|
|
### `/api/list`
|
2022-01-25 02:12:09 +03:00
|
|
|
|
2025-02-10 05:32:28 +03:00
|
|
|
`/api/list` will return return a JSON object containing data about the images
|
|
|
|
within the /images directory
|
2022-01-25 02:12:09 +03:00
|
|
|
|
2025-02-10 05:32:28 +03:00
|
|
|
For example, querying **`http://localhost:3000/api/random`** will return a JSON
|
|
|
|
object that might be as follows
|
2022-01-25 02:12:09 +03:00
|
|
|
|
2025-02-10 05:32:28 +03:00
|
|
|
```json
|
|
|
|
[
|
|
|
|
{ "filename": "0.jpg", "id": "0", "url": "/api/id?id=0" },
|
|
|
|
{ "filename": "1.jpg", "id": "1", "url": "/api/id?id=1" },
|
|
|
|
{ "filename": "10.jpg", "id": "2", "url": "/api/id?id=2" },
|
|
|
|
{ "filename": "11.jpg", "id": "3", "url": "/api/id?id=3" }
|
|
|
|
]
|
|
|
|
```
|
2022-01-25 02:12:09 +03:00
|
|
|
|
2025-02-10 05:32:28 +03:00
|
|
|
### `/api/random`
|
2022-01-25 02:12:09 +03:00
|
|
|
|
2023-10-27 10:48:26 +03:00
|
|
|
`/api/random` will return a random image from the list of available images
|
2022-01-25 02:12:09 +03:00
|
|
|
|
|
|
|
## License
|
|
|
|
|
2025-02-10 05:32:28 +03:00
|
|
|
**catApi** is licensed under the [MIT License](./LICENSE)
|