Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wesleybertipaglia/spring-blog

Spring Blog is a RESTful web service that allows users to sign up, create posts, and interact with other users' posts.
https://github.com/wesleybertipaglia/spring-blog

backend docker java mysql project spring swagger

Last synced: about 4 hours ago
JSON representation

Spring Blog is a RESTful web service that allows users to sign up, create posts, and interact with other users' posts.

Awesome Lists containing this project

README

        

# Spring Blog

Spring Blog is a RESTful web service that allows users to sign up, create posts, and interact with other users' posts. It is built using Spring Boot, Spring Data JPA, Spring Security, Spring Test, MySQL, Swagger and Docker.

### Table of Contents

- [Features](#features)
- [Usage](#usage)
- [Endpoints](#endpoints)
- [License](#license)
- [Acknowledgements](#acknowledgements)

## Features

- Sign up / Sign in / Sign out
- Create, read, update, and delete posts
- Like and comment on posts
- View all posts, posts by a specific user, and posts liked by a specific user
- View all comments or likes on a post
- View all users or a specific user

## Usage

### Prerequisites

- Docker and Docker Compose
- Java 17 or later
- Maven

### Running the application

1. Clone the repository
2. Run the command `docker-compose up` to start the PostgreSQL database
3. Run the application using the command `mvn spring-boot:run` or start the application in your IDE

### API Documentation

The API documentation is available at [http://localhost:8080/swagger-ui.html](http://localhost:8080/swagger-ui.html).

### Testing

Run the command `mvn test` to run the tests.

## Endpoints

### Authentication

- `POST /api/auth/signup` - Sign up
- `POST /api/auth/signin` - Sign in
- `POST /api/auth/signout` - Sign out

### Me

- `GET /api/me` - Get the current user
- `PUT /api/me` - Update the current user
- `DELETE /api/me` - Delete the current user
- `GET /api/me/posts` - Get all posts by the current user
- `GET /api/me/likes` - Get all posts liked by the current user
- `GET /api/me/comments` - Get all comments by the current user

### Users

- `GET /api/users` - Get all users
- `GET /api/users/{id}` - Get a user by ID

### Posts

- `GET /api/posts` - Get all posts
- `POST /api/posts` - Create a post
- `GET /api/posts/{id}` - Get a post by ID
- `PUT /api/posts/{id}` - Update a post by ID
- `DELETE /api/posts/{id}` - Delete a post by ID

### Likes

- `POST /api/likes/{postId}` - Like a post
- `DELETE /api/likes/{postId}` - Unlike a post
- `GET /api/likes/{postId}` - Get all likes on a post

### Comments

- `POST /api/comments/` - Comment on a post
- `GET /api/comments/{postId}` - Get all comments on a post
- `GET /api/comments/{id}` - Get a comment by ID
- `PUT /api/comments/{id}` - Update a comment by ID
- `DELETE /api/comments/{id}` - Delete a comment by ID

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Acknowledgements

- [Spring Boot](https://spring.io/projects/spring-boot)
- [Spring Data JPA](https://spring.io/projects/spring-data-jpa)
- [Spring Security](https://spring.io/projects/spring-security)
- [Spring Test](https://spring.io/guides/gs/testing-web/)
- [PostgreSQL](https://www.postgresql.org/)
- [Docker](https://www.docker.com/)
- [Swagger](https://swagger.io/)
- [JUnit 5](https://junit.org/junit5/)
- [Mockito](https://site.mockito.org/)