https://github.com/sergiomarquezdev/personal-blog-back
https://github.com/sergiomarquezdev/personal-blog-back
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/sergiomarquezdev/personal-blog-back
- Owner: sergiomarquezdev
- Created: 2024-08-14T09:16:14.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-20T14:42:08.000Z (almost 2 years ago)
- Last Synced: 2024-08-23T11:31:47.998Z (almost 2 years ago)
- Language: Java
- Size: 31.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Personal Blog Backend
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.
## Features
- Create and retrieve blog posts
- Search posts by title
- View individual post details
- Like posts
- Comment on posts
- Handle development and production profiles
## Technologies Used
- Java
- Spring Boot
- Spring Data JPA
- PostgreSQL
- Lombok
- JUnit and Mockito for testing
## Getting Started
### Prerequisites
- Java JDK 21
- Maven
- PostgreSQL
### Installation
1. Clone the repository:
```
git clone https://github.com/your-username/personal-blog-backend.git
```
2. Navigate to the project directory:
```
cd personal-blog-backend
```
3. Build the project:
```
mvn clean install
```
### Database Configuration
Ensure you have PostgreSQL installed and configured. Then, update the `application.yml` file with your database credentials:
```
yaml:src/main/resources/application.yml
```
### Running the Application
Run the application using Maven:
```
mvn spring-boot:run
```
The application will be available at `http://localhost:8080/blog`.
## Project Structure
- `src/main/java/dev/sergiomarquez/blog`: Contains the main source code
- `post`: Handles the logic related to blog posts
- `comment`: Handles the logic related to comments
- `utils`: Contains general utilities
## Key Endpoints
- `POST /api/posts`: Creates a new blog post
- `GET /api/posts`: Retrieves all blog posts
- `GET /api/posts/{postId}`: Retrieves a specific blog post
- `PATCH /api/posts/{postId}/like`: Likes a post
- `GET /api/posts/search/{title}`: Searches posts by title
- `POST /api/comments/create`: Creates a new comment
- `GET /api/comments/post/{postId}`: Retrieves comments for a specific post
## Testing
Run unit tests with:
```
mvn test
```
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## License
This project is licensed under the MIT License - see the `LICENSE.md` file for details.