marcelocaser / URLShortener

A URL Shortener Service built with Java, Spring Boot, and Redis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

URL Shortener

A Java Service built with Spring Boot, and Redis.

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 Redis(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
  1. Build the project
gradle build
  1. 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>'
}

About

A URL Shortener Service built with Java, Spring Boot, and Redis


Languages

Language:Java 100.0%