catApi/README.md

40 lines
1.1 KiB
Markdown
Raw Permalink Normal View History

# 🐾 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
2023-10-27 07:48:26 +00:00
## Usage
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.
2023-10-27 07:48:26 +00:00
### API Documentation
2023-10-27 07:48:26 +00:00
**catApi** exposes several endpoints.
2023-10-27 07:48:26 +00:00
#### ID
2023-10-27 07:48:26 +00:00
`/api/id` will return the image with the associated ID.
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".
2023-10-27 07:48:26 +00:00
#### List
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
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
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"}]`
2023-10-27 07:48:26 +00:00
#### Random
2023-10-27 07:48:26 +00:00
`/api/random` will return a random image from the list of available images
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
## License
2023-10-27 07:48:26 +00:00
> **catApi** is licensed under the [MIT](https://github.com/NotAShelf/catApi/blob/v2/LICENSE) license.