This project demonstrates a simple CRUD (Create, Read, Update, Delete) API implementation using Spring Boot with file system storage for managing student records.
- GET
/api/students
: Retrieves all students. - GET
/api/students/{id}
: Retrieves a student by ID. - POST
/api/students
: Creates a new student. - PUT
/api/students/{id}
: Updates an existing student by ID. - DELETE
/api/students/{id}
: Deletes a student by ID.
Ensure you have the following installed:
- Java Development Kit (JDK) 8 or higher
- Maven
- Postman (for API testing)
-
Clone the repository
git clone <repository_url> cd spring-boot-crud-api
-
Run the application
mvn spring-boot:run
The application will start on port 8081 by default.
-
Testing the API
Use Postman or any REST client to test the API endpoints:
- Import the provided Postman collection (
spring-boot-file-system-crud.json
) to test CRUD operations. - Set the base URL in your environment variables (
base_url=http://localhost:8081/api/students
).
- Import the provided Postman collection (
- GET
/api/students
: Retrieves all students. - GET
/api/students/{id}
: Retrieves a student by ID. - POST
/api/students
: Creates a new student. - PUT
/api/students/{id}
: Updates an existing student by ID. - DELETE
/api/students/{id}
: Deletes a student by ID.
- Spring Boot
- Maven
- Jackson (JSON serialization/deserialization)
Student records are stored as JSON objects in a file (students.json
) within the project directory.