Very simple URL shortener written with golang
docker --version
sudo systemctl start docker.service
sudo docker-compose build --no-cache
sudo docker-compose up --force-recreate
Send request to 'http://localhost:9000/api/ping':
curl -X GET "http://localhost:9000/api/ping" -H "Accept: application/json"
{
"status": true,
"message": "ok",
"errors": null,
"data": "pong"
}
curl -X POST "http://localhost:9000/api/create-url" -H "Content-Type: application/json" -H "Accept: application/json" -d '{"original_url": "http://google.com"}'
{
"status": true,
"message": "created",
"errors": null,
"data": {
"original_url": "http://google.com",
"short_url": "http://localhost:9000/OZcovl3I"
}
}
curl -X GET "http://localhost:9000/api/{url_name}" -H "Accept: application/json"
{
"status": true,
"message": "ok",
"errors": null,
"data": {
"original_url": "http://google.com",
"click": 3
}
}
sudo docker exec -it url_shortener_app bash
go clean -testcache
go test ./...