Shortify is a URL shortening service developed in Java 17 using Spring Boot and PostgreSQL. This project allows users to shorten long URLs and retrieve them via a short identifier.
- Shortens long URLs into a short format.
- Stores the relationship between original and shortened URLs in a PostgreSQL database.
- Retrieves the original URL from its shortened version.
- Generates a unique identifier using Base64 encoding.
- Java 17
- PostgreSQL
- Maven (for building and managing dependencies)
-
Clone this repository:
git clone https://github.com/ocollp/shortify.git
-
Navigate to the project directory:
cd shortify
-
Set up your PostgreSQL database:
- Create a database for the project.
- Ensure that the database is up and running.
- Configure the application.properties file:
- Set the database connection URL and the base URL for the service.
-
Build the project using Maven
mvn clean install
-
Run the application:
mvn spring-boot:run
- Shorten a URL: Send a POST request to http://localhost:8080/shortify with a body containing the original URL.
- Retrieve an original URL: Send a GET request to http://localhost:8080/shortify/{shortenedPath}.
- Shorten URL:
POST /shortify Content-Type: application/json { "originalUrl": "www.example.com/looooooong-url" }
- Retrieve Original URL:
GET /shortify/12e6e