Online News Portal (Backend)
The Online News Portal is a backend application developed using Spring Boot. It provides RESTful APIs to manage news articles, users, roles, categories, comments, and advertisements. This project offers a robust, scalable backend to support real-time news posting and user interactions in a digital news platform.
- CRUD operations for articles, categories, and advertisements
- Role-based access control for Admins and Users
- User registration and login functionality
- Commenting on articles
- Categorization and filtering of news content
- Swagger integration for API testing and documentation
| Component | Technology |
|---|---|
| Backend Framework | Spring Boot (Spring Tool Suite) |
| Database | MySQL |
| API Documentation | Swagger |
| Hosting | (Optional) AWS / Google Cloud / Azure |
- Login: Handles authentication.
- User: Stores user details like name, mobile number, email, and address.
- Roles: Defines Admin and User roles.
- Permission: Assigns access levels to roles.
- News: Stores articles with type, description, and metadata.
- Latest Post: Highlights recently added articles.
- Contents: Stores various media contents linked to articles.
- Comment: Allows users to comment and edit on articles.
- Admin: Can manage users, articles, and advertisements.
- Advertisement: Stores ads with title, description, type, and date.
- NewsPortal: Manages system structure and news categories.
- Category: Organizes articles under specific categories.
- Java 17
- Spring Boot
- MySQL
- Maven
-
Create a database named:
news_portal. -
Update
application.properties:
spring.datasource.url=jdbc:mysql://localhost:3306/news_portal
spring.datasource.username=root
spring.datasource.password=yourpassword
###Run the application:
./mvnw spring-boot:run
Access Swagger API Docs:
http://localhost:8080/swagger-ui/
##User Roles:
Role Permissions
Admin- Create, update, delete articles, manage users & ads
User- View articles, post comments, edit profile
Sample API Endpoints:
Method Endpoint Description
GET /api/news List all news articles
POST /api/news Create a new article
GET /api/users List all users (Admin only)
POST /api/comments Add a comment to an article
GET /api/categories View all categories