Blogging Application
About
The Blogging Application is a simple and scalable web application built using Spring Boot. It allows users to create, read, update, and delete blog posts. The application is designed to demonstrate the core concepts of web development, REST APIs, and the integration of a backend server with a database.
Features
-
User Management
- User registration and login functionality.
- Role-based access control (e.g., Admin, User).
-
Blog Management
- Create, update, and delete blog posts.
- View all blogs or individual blogs.
-
Category Management
- Organize blogs by categories.
- CRUD operations for categories.
-
Comment System
- Add comments to blog posts.
- Manage comments as an admin.
-
Search Functionality
- Search blogs by title or content.
Technologies Used
- Backend: Spring Boot, Spring MVC, Spring Data JPA
- Database: MySQL (or any RDBMS of your choice)
- Build Tool: Maven
- Languages: Java
Getting Started
Prerequisites
- Java Development Kit (JDK): Ensure you have JDK 8 or higher installed.
- Maven: Install Apache Maven for building and managing dependencies.
- Database: Set up MySQL or any preferred database.
- IDE: Use an IDE like IntelliJ IDEA, Eclipse, or VS Code for development.
Installation
-
Clone the repository:
git clone https://github.com/reetpriye/blogging-app-springboot.git cd blogging-app-springboot
-
Set up the database:
- Create a database named
blog_app
(or any preferred name). - Update the database configurations in the
application.properties
file located insrc/main/resources
:spring.datasource.url=jdbc:mysql://localhost:3306/blog_app spring.datasource.username=your_username spring.datasource.password=your_password spring.jpa.hibernate.ddl-auto=update spring.jpa.show-sql=true
- Create a database named
-
Build the project:
mvn clean install
-
Run the application:
mvn spring-boot:run
-
Access the application at:
http://localhost:8080
Usage
API Endpoints
Authentication
POST /api/auth/register
- Register a new user.POST /api/auth/login
- Log in and retrieve a token.
Blog Management
GET /api/blogs
- Get all blog posts.GET /api/blogs/{id}
- Get a specific blog post by ID.POST /api/blogs
- Create a new blog post.PUT /api/blogs/{id}
- Update an existing blog post.DELETE /api/blogs/{id}
- Delete a blog post.
Category Management
GET /api/categories
- List all categories.POST /api/categories
- Add a new category.
Comment Management
POST /api/blogs/{id}/comments
- Add a comment to a blog post.
Testing the Application
You can test the APIs using tools like:
- Postman: For API testing.
- Swagger UI: If integrated (accessible at
/swagger-ui.html
).
Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch for your feature/bugfix.
- Commit your changes.
- Push your branch and create a pull request.
License
This project is open-source and available under the MIT License.