An app to manage students' data in a college database. This project includes CRUD operations (Create, Read, Update, Delete) for managing student records. It's built using Spring Boot, a powerful framework for creating production-grade applications.
To set up and run this project, you'll need the following:
- Apache Tomcat 🐅 (embedded in Spring Boot)
- MySQL Server 🦈 (for the database)
- IntelliJ IDEA or Eclipse Editor
- Java 17 or a higher version
- Internet connection 🛜
Follow these steps to get the project running on your local machine:
-
Clone the repository:
git clone [https://github.com/Ankitk2021/StudentManagementSystem.git](https://github.com/Ankitk2021/StudentManagementSystem.git)
-
Database Configuration:
- Ensure you have a database named
CollegeDB
set up in your MySQL server. - Update the database credentials (username and password) in the
application.properties
file located atsrc/main/resources/application.properties
.
- Ensure you have a database named
-
Import and Run:
- Open the project in your preferred IDE (IntelliJ or Eclipse). The IDE should automatically recognize it as a Spring Boot project.
- Add any missing dependencies by importing the project with Maven (from the
pom.xml
file). - Run the project by executing the
main
method in the main Spring Boot application class. 🏃♂️➡️
Once the project is running, the application will be accessible at http://localhost:8080
. Here are the available API endpoints for managing student data:
This is the base endpoint for all student-related operations.
-
GET
Request- Endpoint:
/students
- Description: Retrieves a list of all students from the database.
- Response: A JSON array of student objects.
- Example JSON Object:
{ "id": 1, "rollNo": 56, "name": "Ankit", "email": "ankit@email.com", "course": "BTech", "branch": "CSE", "dob": "1878-09-12" }
- Endpoint:
-
POST
Request- Endpoint:
/students
- Description: Adds a new student record to the database.
- Request Body: A JSON object containing the new student's details.
- Example Request Body:
{ "name": "Ankit", "email": "ankit@email.com", "course": "BTech", "branch": "CSE", "rollNo": 56, "dob": "1878-09-12" }
- Endpoint:
-
PATCH
Request- Endpoint:
/students/{id}
- Description: Updates one or more specific fields of a student record without replacing the entire object.
- Request Body: A JSON object containing only the fields you wish to update.
- Example:
http://localhost:8080/students/1
to update the name and email of the student with ID1
.
- Endpoint:
-
DELETE
Request- Endpoint:
/students
- Description: Deletes a student record from the database using their unique ID.
- Example:
http://localhost:8080/students?id=1
will delete the student with ID1
. Other fields likeemail
androll-number
can be used to pop the student from the database.
- Endpoint:
These endpoints provide specific search and retrieval functionality:
-
GET
Request: Find by Roll Number- Endpoint:
/students
- Description: Finds and retrieves a single student by their unique roll number.
- Example:
http://localhost:8080/students?rollno=56
- Endpoint:
-
GET
Request: Find by Name- Endpoint:
/students
- Description: Searches for and retrieves all students whose name matches the provided name.
- Example:
http://localhost:8080/students?name=Ankit
- Endpoint: