An url shortener server realized by golang and redis. Followed the guide from Let's build a URL shortener in Go - Part I. Besides, I added extra feature for deployment, a docker file and docker-compose for quick start in any environment.
- build go server's image
docker build -t go-url-server .
- run service on
docker-compose up
- shorten your url
curl -X POST {your-host}/url -d '{"long_url": "https:google.com"}'
# expected output
# {your-host}/Lhr4BWAi
- check if server redirect {your-host}/Lhr4BWAi to https://google.com
- Hash Original URL With Sha256
- Encode the Hashed Result With Base58
- This server encoded URL with base58 for improving user experience. It avoided tje usage of the following confusing characters: "O", "0", "I", "l", "+" and "/".
- When user hit the host IP with shortened url, server would lookup the original url in redis and redirect the user to original url.
- Add go server Dockerfile
- Add docker-compose
- Check if generated duplicated URL