This is a simple URL shortener application API written in Go.
It uses Redis for caching to store token of URL and return domain with token.
API idempotency will be implemented.
- Clone the repository
git clone https://github.com/shari4ov/url-shortener-go
- To set domain name for the shortened URLs, change the value of
TINY_DOMAIN
indocker-compose.yml
file
- Run the application
task run
- Open postman and send a POST request to
http://localhost:8080
with the following body:
{
"url": "https://www.google.com"
}
- You will receive a response with the shortened URL:
{
"url": "http://${TINY_DOMAIN}/1"
}
- Open the shortened URL in your browser and you will be redirected to the original URL
http://${TINY_DOMAIN}/1 -> https://www.google.com