docs: update README
Some checks are pending
Go / build (push) Waiting to run

This commit is contained in:
raf 2025-02-10 05:32:28 +03:00
parent 6393fd1e4d
commit d377c9419d
No known key found for this signature in database
GPG key ID: EED98D11B85A2819

View file

@ -1,39 +1,40 @@
# 🐾 catApi
> **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
catApi is a minimal, self-hostable API (and frontend) for serving pictures of...
you guessed, it cats! Who doesn't like cats?
## Usage
## API Documentation
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.
There are several API endpoints that you may query.
### API Documentation
**catApi** exposes several endpoints.
#### ID
### `/api/id`
`/api/id` will return the image with the associated ID.
For example **`http://localhost:3000/api/id?id=3`** will return the image with the ID of "3".
For example **`http://localhost:3000/api/id?id=3`** will return the image with
the ID of "3".
#### List
### `/api/list`
`/api/list` will return eturn a JSON object containing data about the images within the /images directory
`/api/list` will return return a JSON object containing data about the images
within the /images directory
For example, **`http://localhost:3000/api/random`** will return a JSON object that might be as follows
For example, querying **`http://localhost:3000/api/random`** will return a JSON
object that might be as follows
> `[{"id":"0","url":"/api/id?id=0"},{"id":"1","url":"/api/id?id=1"},{"id":"2","url":"/api/id?id=2"}]`
```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" }
]
```
#### Random
### `/api/random`
`/api/random` will return a random image from the list of available images
### Self-hosting
TODO
## License
> **catApi** is licensed under the [MIT](https://github.com/NotAShelf/catApi/blob/v2/LICENSE) license.
**catApi** is licensed under the [MIT License](./LICENSE)