2022-01-24 23:12:09 +00:00
|
|
|
# 🐾 catApi
|
2022-01-25 13:00:54 +00:00
|
|
|
|
2023-10-27 07:48:26 +00:00
|
|
|
> **catApi** is a minimal, self-hostable API endpoint for serving pictures of, you guessed it, cats!
|
|
|
|
> but it could be used to serve anything, really
|
2022-01-24 23:12:09 +00:00
|
|
|
|
2023-10-27 07:48:26 +00:00
|
|
|
## Usage
|
2022-01-24 23:12:09 +00:00
|
|
|
|
2023-10-27 07:48:26 +00:00
|
|
|
There are two ways to "use" **catApi** - you can either serve it, blessing the world with pictures of your cat
|
|
|
|
or be served. Below is the API documentation for visiting an existing instance of catApi.
|
2022-01-24 23:12:09 +00:00
|
|
|
|
2023-10-27 07:48:26 +00:00
|
|
|
### API Documentation
|
2022-01-24 23:12:09 +00:00
|
|
|
|
2023-10-27 07:48:26 +00:00
|
|
|
**catApi** exposes several endpoints.
|
2022-01-24 23:12:09 +00:00
|
|
|
|
2023-10-27 07:48:26 +00:00
|
|
|
#### ID
|
2022-01-24 23:12:09 +00:00
|
|
|
|
2023-10-27 07:48:26 +00:00
|
|
|
`/api/id` will return the image with the associated ID.
|
2022-01-24 23:12:09 +00:00
|
|
|
|
2023-10-27 07:48:26 +00:00
|
|
|
For example **`http://localhost:3000/api/id?id=3`** will return the image with the ID of "3".
|
2022-01-24 23:12:09 +00:00
|
|
|
|
2023-10-27 07:48:26 +00:00
|
|
|
#### List
|
2022-01-24 23:12:09 +00:00
|
|
|
|
2023-10-27 07:48:26 +00:00
|
|
|
`/api/list` will return eturn a JSON object containing data about the images within the /images directory
|
2022-01-24 23:12:09 +00:00
|
|
|
|
2023-10-27 07:48:26 +00:00
|
|
|
For example, **`http://localhost:3000/api/random`** will return a JSON object that might be as follows
|
2022-01-24 23:12:09 +00:00
|
|
|
|
2023-10-27 07:48:26 +00:00
|
|
|
> `[{"id":"0","url":"/api/id?id=0"},{"id":"1","url":"/api/id?id=1"},{"id":"2","url":"/api/id?id=2"}]`
|
2022-01-24 23:12:09 +00:00
|
|
|
|
2023-10-27 07:48:26 +00:00
|
|
|
#### Random
|
2022-01-24 23:12:09 +00:00
|
|
|
|
2023-10-27 07:48:26 +00:00
|
|
|
`/api/random` will return a random image from the list of available images
|
2022-01-24 23:12:09 +00:00
|
|
|
|
2023-10-27 07:48:26 +00:00
|
|
|
### Self-hosting
|
2022-01-25 13:00:54 +00:00
|
|
|
|
2023-10-27 07:48:26 +00:00
|
|
|
TODO
|
2022-01-24 23:12:09 +00:00
|
|
|
|
|
|
|
## License
|
|
|
|
|
2023-10-27 07:48:26 +00:00
|
|
|
> **catApi** is licensed under the [MIT](https://github.com/NotAShelf/catApi/blob/v2/LICENSE) license.
|