TinyURL service is standalone service which creates tiny URLs and stores them in SQL DB.
There are many online services available online I created one. This package comes along with a Docker file which can package an application and create an image. Here are the steps which will be required to set this service lcoally- git clone https://github.com/sushiljacksparrow/tinyurl.git
- docker build -t tinyurl .
- docker tag tinyurl <DOCKER_REPOSITORY>/tinyurl:1.0
- docker push <DOCKER_REPOSITORY>/tinyurl:1.0
- minikube start
- kubectl apply -f deployment.yml
- kubectl apply service.yml
- kubectl port-forward service/tinyurl-service 8080:80
Once it is set up then you can use PostMan and hit URL
-
Create Short URL
POST http://localhost:8080/url/tiny
{ "original_url": "http://random-very-log-url.com", "user": "random-user" }
Response ` { "tiny_url": "" } `
-
Get Original URL
GET http://localhost:8080/url/long?TinyUrl=<SHORT_SIX_CHAR_URL>&User=