A URL shortener service.
- Shortens the URLs.
- Supports redirects for shortened URLs.
- Shows metrics for top 3 shortened domains.
- Uses Redis for storing the data regarding URLs.
- Reports same URL for multiple shortening sessions of same URL instead of generating new one.
You need to have Go (>1.13 at least) and Redis installed.
- Clone this repository.
- Run
make buildto build the binary named asblink.bin. - In another terminal session, start a local redis server through the
redis-servercommand. It should be running by default on port6379. - Set environment variables:
REDIS_ADDRESS=localhost:6379APP_PORT=8080
- Run
make runto execute the binary.
- Download the
docker-compose.ymlfile. - To execute Blink, run
docker-compose up -dcommand and then the app should be ready on port "8080". - The
docker-compose.ymluses my docker image pushed on Docker Hub.
- POST
/api/shorten: Returns the shortened URL for the URL sent in the request body in the below form.
{"long_url":"https://google.com/helloworld"}- GET
/api/metrics: Returns the top 3 most shortened domains along with the count of being shortened.