I was trying to work on the URL shortener microservice and am unable to understand:
User Story: I can pass a URL as a parameter and I will receive a shortened URL in the JSON response. User Story: If I pass an invalid URL that doesn't follow the valid http://www.example.com format, the JSON response will contain an error instead. User Story: When I visit that shortened URL, it will redirect me to my original link.
I understnad that:
- If URL cannot be shortened, it should return an error json.
- The correct json will have the shortened URL as well.
- But what I do not understand is what/how the url shortening should happen and what role will the db play in this. I would really appreciate if someone could please help me out in understand this.