A Singleton class responsible for:
1. Generating ID
2. Using ID to create unique URL ID
3. Using unique URL ID to retrieve original ID
URLValidator.java
A Singleton class responsible for validating URL's validity URLController.java
A Spring Boot Controller responsible for:
1. Serving an endpoint to shorten URL
2. Redirect shortened URL to the original URL
URLRepository
A Java class responsible for abstracting Redis(database) read/write logic URLConverterService.java
A Java class used to abstract URL Shortening and URL Retrieval process
URLShortenerApplication.java
The entry point for the Spring application
1. Start up Redis' Server
redis-server
- Build the project
gradle build
- Run the project
gradle run
By default the Server will run on localhost:8080/shortener
To test, send POST Request to localhost:8080/shortener with a body of type application/json with body
{
'url' : '<INSERT URL>'
}