The Blog REST API is a backend application designed to manage blog posts and their associated authors. This project demonstrates proficiency in Spring Boot, RESTful API design, and integration with external services.
Features
- Post Management:
- Create, update, delete, and retrieve blog posts.
- Fetch posts by author ID.
- Track post creation and update timestamps.
- Author Integration:
- Retrieve author details from an external API.
- Fetch all authors or a specific author by ID.
- Validation and Error Handling:
- Input validation using Jakarta Validation.
- Custom error responses for invalid or missing resources.
- Concurrency Control:
- Optimistic locking with versioning to manage concurrent updates.
Technologies Used
- Java 23: For modern language features.
- Spring Boot: For rapid development of RESTful web services.
- Spring Data JPA: To interact with the database.
- REST Client: For external API integration.
- Lombok: To reduce boilerplate code.
- Jakarta Validation: For input validation.
- H2 Database: As the in-memory database for testing.
- JSON Placeholder: For simulating an external API.
How to Run
- Clone the repository:
git clone https://github.com/Borys35/spring-boot-blog-rest-api.git - Navigate to the project directory:
cd spring-boot-blog-rest-api - Build and run the application:
./mvnw spring-boot:run - Access the API at http://localhost:8080.
Learning Outcomes
This project showcases:
- Building RESTful APIs using Spring Boot.
- Integrating external APIs.
- Managing concurrency and enforce data validation.
- Writing clean, maintainable, and testable code.