Sure, here is an updated version of the README.md with emojis:
ShortifyGo is a URL shortening service built with Go and Docker. It uses Redis for data storage and provides an API to shorten and retrieve URLs.
To get started with ShortifyGo, you'll need to have Docker and Docker Compose installed on your machine.
-
Clone the repository:
git clone https://github.com/billybillysss/shortifygo.git cd shortifygo -
Build and start the services:
docker-compose up --build
Once the services are up and running, you can access the API at http://localhost:7001.
To shorten a URL, send a POST request to /api/v1 with the URL in the request body.
Example:
curl -X POST -d '{"url":"https://www.example.com"}' http://localhost:7001/api/v1To retrieve the original URL, send a GET request to /{shortId}.
Example:
curl http://localhost:7001/retrieve/abc123SHORTIFYGO/
βββ .data/
βββ api/
β βββ database/
β β βββ redis.go
β βββ handlers/
β β βββ retriever.go
β β βββ shortener.go
β βββ utils/
β βββ .env
β βββ Dockerfile
β βββ go.mod
β βββ go.sum
β βββ main.go
βββ db/
β βββ Dockerfile
βββ docker-compose.yml
.data/- Directory for Redis data storage..env- Environment variables file.api/- Contains the source code for the API.database/redis.go- Redis client and database operations.handlers/retriever.go- Handler for retrieving URLs.handlers/shortener.go- Handler for shortening URLs.utils/- Utility functions (if any)..env- Environment variables for the API.Dockerfile- Dockerfile for building the API service.go.mod- Go module file.go.sum- Go dependencies.main.go- Entry point of the API service.
db/- Contains the Dockerfile for the Redis service.docker-compose.yml- Docker Compose file to run the services.
- Description: Shortens a given URL.
- Request Body: JSON containing the URL to be shortened and an optional short code.
{ "URL": "https://www.example.com", "Short": "" } - Response Body: JSON containing the status, original URL, short code, remaining requests, and limit reset time.
{ "Status": "success", "URL": "https://www.example.com", "Short": "http://{Domain}/{ShortId}", "RemainRequest": 5, "LimitRestTime": "2024-05-23T00:00:00Z" }
- Description: Retrieves the original URL for a given shortened code.
- Path Parameters:
shortId- The code representing the shortened URL.