From d377c9419de1e11553bd1d79cfe122250abcb802 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 10 Feb 2025 05:32:28 +0300 Subject: [PATCH] docs: update README --- README.md | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 2a2866b..3e42cd8 100644 --- a/README.md +++ b/README.md @@ -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)