The Journal REST API is a Spring Boot application designed to manage journal entries for users. It provides endpoints for creating, reading, updating, and deleting journal entries, as well as user management functionalities.
- User Authentication and Authorization
- CRUD operations for Journal Entries
- User Management
- Health Check Endpoint
- MongoDB Integration
- Java 17 or Higher
- Spring Boot 3.3.2
- Spring Data MongoDB
- Spring Security
- Lombok
- Maven
-
Clone the repository:
git clone https://github.com/yourusername/Journal-Rest-API.git cd Journal-Rest-API
-
Build the project:
mvn clean install
-
Run the application:
mvn spring-boot:run
The application uses a MongoDB database. Ensure that MongoDB is running and accessible. You can configure the MongoDB connection in the application.properties
file.
spring.data.mongodb.uri=mongodb://localhost:27017/yourdatabase
Here is the postman collection, import it Journal App postman_collection
- Create User:
POST /public/create-user
- Request Body:
{ "userName": "string", "password": "string" }
- Get All Journals:
GET /journal
- Get Journal by ID:
GET /journal/{id}
- Create Journal:
POST /journal
- Request Body:
{ "title": "string", "content": "string" }
- Update Journal:
PUT /journal/{id}
- Request Body:
{ "title": "string", "content": "string" }
- Delete Journal:
DELETE /journal/{id}
- Get All Users:
GET /admin
- Delete User:
DELETE /admin/{userName}
- Check Health:
GET /health
The application uses Spring Security for authentication and authorization. The following roles are defined:
- USER: Can manage their own journal entries.
- ADMIN: Can manage users and their journal entries.
Contributions are welcome! Please fork the repository and submit a pull request. Create an issue first before PR.
If you are a Spring Boot learner, we encourage you to debug this application and contribute to its improvement. Here are some steps to get started:
- Set up your development environment: Follow the installation steps above to set up the project locally.
- Explore the codebase: Familiarize yourself with the structure of the project and the different components.
- Debug the application: Use your IDE's debugging tools to step through the code and understand how it works.
- Identify areas for improvement: Look for bugs, performance issues, or areas where the code can be refactored.
- Contribute: Fork the repository, make your changes, and submit a pull request.