This project is a robust backend application for a personal blog, built with Spring Boot. It provides a RESTful API for handling the creation, viewing, and interaction with blog posts.
- Create and retrieve blog posts
- Search posts by title
- View individual post details
- Like posts
- Comment on posts
- Handle development and production profiles
- Java
- Spring Boot
- Spring Data JPA
- PostgreSQL
- Lombok
- JUnit and Mockito for testing
- Java JDK 21
- Maven
- PostgreSQL
-
Clone the repository:
git clone https://github.com/your-username/personal-blog-backend.git -
Navigate to the project directory:
cd personal-blog-backend -
Build the project:
mvn clean install
Ensure you have PostgreSQL installed and configured. Then, update the application.yml file with your database credentials:
yaml:src/main/resources/application.yml
Run the application using Maven:
mvn spring-boot:run
The application will be available at http://localhost:8080/blog.
src/main/java/dev/sergiomarquez/blog: Contains the main source codepost: Handles the logic related to blog postscomment: Handles the logic related to commentsutils: Contains general utilities
POST /api/posts: Creates a new blog postGET /api/posts: Retrieves all blog postsGET /api/posts/{postId}: Retrieves a specific blog postPATCH /api/posts/{postId}/like: Likes a postGET /api/posts/search/{title}: Searches posts by titlePOST /api/comments/create: Creates a new commentGET /api/comments/post/{postId}: Retrieves comments for a specific post
Run unit tests with:
mvn test
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE.md file for details.