jyjin2 / urlshortener

0 stars 0 forks source link

URL Shortener

A Java Service built with Spring Boot, and MSSQL.

common

IDConverter.java
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

controller

URLController.java
A Spring Boot Controller responsible for:
1. Serving an endpoint to shorten URL
2. Redirect shortened URL to the original URL

repository

URLRepository
A Java class responsible for abstracting MSSQL(database) read/write logic

service

URLConverterService.java
A Java class used to abstract URL Shortening and URL Retrieval process
URLShortenerApplication.java
The entry point for the Spring application

To run:

1. Start up Redis' Server ``` redis-server ``` 2. Build the project ``` gradle build ``` 3. 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' : '' } ```