📚 feat(docs): improve README

This commit is contained in:
Siesta
2025-07-28 21:55:04 +02:00
parent b50a62a52d
commit c3386df42c
+20 -5
View File
@@ -1,12 +1,12 @@
# 🛋️ Laterna (Server) # 🛋️ Laterna (Server)
Laterna is an lightweight REST api for sharing HEX color codes between 2 (or more) lamps with simple HTTP requests, written in go. Laterna is a lightweight REST api for sharing HEX color codes between 2 (or more) lamps with simple HTTP requests, written in go.
> [!NOTE] > [!NOTE]
> This project was developed with my own use case in mind. > This project was developed with my own use case in mind.
> This is also my first REST api and my first project in go, so expect bugs and weird annoyances/limitations. > Expect bugs and weird annoyances/limitations, as this is my first REST api and my first time using go
## 🏵️ Setup ## Setup
### 1. Clone the repository ### 1. Clone the repository
@@ -35,6 +35,8 @@ or use the makefile:
## 🛜 API Documentation ## 🛜 API Documentation
<details><summary>Docs</summary>
### Base URL ### Base URL
`http://your-server.com/api/v1` `http://your-server.com/api/v1`
@@ -72,6 +74,9 @@ Authorization: <token>
| GET | `/colors/{id}` | Get the current color of a specific controller | — | | GET | `/colors/{id}` | Get the current color of a specific controller | — |
| PUT | `/colors/{id}` | Set the color of a controller | `{ "color": "#FF0000" }` | | PUT | `/colors/{id}` | Set the color of a controller | `{ "color": "#FF0000" }` |
> [!INFO]
> Every specified ID has to be greater than 0
--- ---
### cURL examples ### cURL examples
@@ -83,7 +88,8 @@ $ curl -X POST http://your-server.com/api/v1/controllers \
-H "Authorization: $TOKEN" -H "Authorization: $TOKEN"
``` ```
️ Response with the newly assigned ID. The ID will always be the next available one > [!INFO]
> Response with the newly assigned ID. The ID will always be the next available one
#### Delete a controller #### Delete a controller
@@ -93,7 +99,14 @@ $ curl -X DELETE localhost:8080/api/v1/controllers \
-d '{"ID": 1}' -d '{"ID": 1}'
``` ```
#### Get the current color of a controller #### Get the current color of all controllers
```bash
$ curl -X GET localhost:8080/api/v1/colors/ \
-H "Authorization: $TOKEN"
```
#### Get the current color of a specific controller
```bash ```bash
$ curl -X GET localhost:8080/api/v1/colors/1 \ $ curl -X GET localhost:8080/api/v1/colors/1 \
@@ -107,3 +120,5 @@ $ curl -X PUT localhost:8080/api/v1/colors/1 \
-H "Authorization:$TOKEN" \ -H "Authorization:$TOKEN" \
-d '{"Color": "#C2C342"}' -d '{"Color": "#C2C342"}'
``` ```
</details>