Requirements
Functional Requirements:
- Create a short URL for a given long URL.
- Return the long URL associated with a given short URL.
Non-Functional Requirements:
- The api should respond at max 200ms
- A security check should be done before process to convert the url to short
API Design
Create one get endpoint : "shortenurl"
that one param in query param : "url"
And the endpoint return the url shortent
High-Level Design
React web app call api with the long url then the api return the short url
Detailed Component Design
The react web app have an input to enter a long url and a validate button.
If the user clic validate, a call to the endpoint "shortenurl" with the long url in the input is set to the query params of the call.
Then the api return the shortenurl.
And the react web app display the shorten url.