This project implements a REST API with Spring Boot to solve this challenge.
The main objective is learn Java and implement additional technologies to shorten urls.
- Java 21
- Redis
- Docker 27.0.3
- Spring boot 3.3.1
- Flyway 10.10.0
- H2 2.2.224
- Jedis 5.0.2
-
POST /shorten-url
- Create a shortened URL.
- Request Payload:
{ "longUrl": "https://example.com" } - Response:
{ "longUrl": "https://ziolfadshuosd.com/teste", "shortUrl": "3BAK0", "expirationDate": "2024-08-04T00:19:14.318808458" }
-
GET /{urlShortened}
- Redirect to te url that was shortened, if is valid.
- Response:
{ // Content of url page. }
To run the project, you will need to have docker compose or maven installed on your machine.
-
Clone the repository:
git clone https://github.com/plaisteixo-5/UrlShrinker.git -
Navigate to the project directory:
cd UrlShrinker -
Run docker compose to up the application
docker compose up -
Test the application:
curl --location 'localhost:8080/shorten-url' \--header 'Content-Type: application/json' \--data '{ "longUrl": "https://github.com/"}'
- Implement timeout to cache on redis
- Implement redirect
- Add logs
- Error handling
- Unit tests
- Documentation
- Create image
- Create docker-compose
- Create validations in url
- Upload service design
- Utilize PostgreSQL