chore: update API docs

This commit is contained in:
sjdonado
2025-03-16 14:21:36 +01:00
parent a066b5e5ab
commit 60ebac7150
3 changed files with 18 additions and 24 deletions
+6 -6
View File
@@ -2,18 +2,18 @@
[![Docker Stars](https://img.shields.io/docker/stars/sjdonado/bit.svg)](https://hub.docker.com/r/sjdonado/bit)
[![Docker Image Size](https://img.shields.io/docker/image-size/sjdonado/bit/latest)](https://hub.docker.com/r/sjdonado/bit)
# Bit URL Shortener
Lightweight URL shortener service with minimal resource requirements. Average memory consumption is **20MB RAM** with container disk space under **50MB**.
Bit is highly performant, achieving over 1.8K requests per second with an average latency of 68ms. For detailed benchmark results, see [benchmark](docs/SETUP.md#benchmark).
Images available on [Docker Hub](https://hub.docker.com/r/sjdonado/bit/tags).
## Quick Start
```bash
docker run -p 4000:4000 -e ADMIN_API_KEY=$(openssl rand -base64 32) sjdonado/bit:latest
```
## Why Bit?
It is feature-complete by design. Its strength lies in simplicity, a reliable URL shortener without unnecessary bloat. Bug fixes will continue, but new features aren't planned.
- Minimal tracking setup: Country, browser, os, referer. No cookies or persistent tracking mechanisms are used beyond what's available from a basic client's request.
- Flexible request forwarding system passes client context (IP, user-agent) to destinations via standard X-Forwarded-For and X-Forwarded-User-Agent headers, enabling advanced tracking and integration capabilities when needed.
- Multiple users are supported via API key authentication. Create, list and delete via the [CLI](docs/SETUP.md#cli).
## Minimum Requirements
- 50MB disk space
+1 -1
View File
@@ -3,7 +3,7 @@ require "../lib/controller.cr"
module App::Controllers::Ping
class Get < App::Lib::BaseController
def call(env)
response = {"pong" => "ok"}
response = {"data" => "pong"}
response.to_json
end
end
+11 -17
View File
@@ -7,7 +7,7 @@
- Response Example
```json
{
"message": "pong"
"data": "pong"
}
```
@@ -15,7 +15,7 @@
- Endpoint: `GET /:slug`
- Payload: None
- Response 301
- Response: 301
3. **List All Links**
@@ -34,10 +34,10 @@
{
"id": "730e2202-58f9-478c-a24c-f1c561df6716",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:127.0) Gecko/20100101 Firefox/127.0",
"language": "en-US",
"country": "DE",
"browser": "Firefox",
"os": "Mac OS X",
"source": "Unknown",
"referer": "Direct",
"created_at": "2024-07-12T19:25:22Z"
}
]
@@ -62,10 +62,10 @@
{
"id": "730e2202-58f9-478c-a24c-f1c561df6716",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:127.0) Gecko/20100101 Firefox/127.0",
"language": "en-US",
"country": "DE",
"browser": "Firefox",
"os": "Mac OS X",
"source": "Unknown",
"referer": "Direct",
"created_at": "2024-07-12T19:25:22Z"
}
]
@@ -89,7 +89,7 @@
"data": {
"id": "84f0c7a4-8c4e-4665-b676-cb9c5e40f1db",
"refer": "http://localhost:4000/3wP4BQ",
"origin": "https://monocuco.donado.co/test",
"origin": "https://example.com",
"clicks": []
}
}
@@ -119,13 +119,7 @@
7. **Delete a link by ID**
- Endpoint: `DELETE /api/links/:id`
- Payload: None
- Headers: `X-Api-Key`
- Response Example:
```json
{
"message": "Link deleted"
}
```
- Endpoint: `DELETE /api/links/:id`
- Payload: None
- Headers: `X-Api-Key`
- Response: 204