I just developed for fun (to learn concepts of web servers in golang) not tested and due to no authorization or proper seeding it's not production ready.
Running with Docker Compose
Prerequisites
- Docker
- Docker Compose
Quick Start
- Clone the repository
- Run the application with Redis:
docker-compose up --build
This will start:
- The URL shortener API on port 8080
- Redis on port 6379
Stop the services
Clean up (remove volumes)
Usage Examples
Basic request:
curl -X POST http://127.0.0.1:8080/url/ \ -H "Content-Type: application/json" \ -d '{"url": "https://example.com", "ttl": 10}'
With different TTL:
curl -X POST http://127.0.0.1:8080/url/ \ -H "Content-Type: application/json" \ -d '{"url": "https://google.com", "ttl": 86400}'
Minimal request (if TTL is optional):
curl -X POST http://127.0.0.1:8080/url/ \ -H "Content-Type: application/json" \ -d '{"url": "https://github.com"}'