1) /create?url={} - this will create the short url for the given url. and returns the short url.
2) /get?short_url={} - will return the original/long url for the give short url.
Step-1: Server gets request from the client to create a short url for the given long url.
Step-2: Server process the long url, creates the short url and saves in the Database. Returns short url as response to the request.
Step-3: Client Calls with get url api with the either by using the short url it self or using the get api. The server checks the cache first and then return if it is a cache hit or if it is cache miss then the server is going to check the database and returns the long url as the response.
1) Cache: We are going to use the Distributed Cache. As it is going to solve reliability.
2)Server: The server is going to create hash of the long url and create an uuid and store in the Database. once again if we do check if the url is already exist in the database by using the hash if it is already existing then returns the old uuid, if not then it creates new uuid and stores in the database. When there is get request then first the request checks the cache with uuid, if it is a hit then then returns the long url or if it is a miss then then it checks database and then returns the long url to user and also writes to the cache.
3) Database: database is going to store the uuid, long url and uuid.
The short is not the but https://api-endpoint.com/get/{uuid}