This project is a web API for managing mentors and their assigned students. It allows for the assignment of students to mentors, retrieval of students assigned to a specific mentor, and updating of mentor-student relationships.
📑 Table of Contents
- 📦 Installation
- 🚀 Usage
- 🔗 API Endpoints
- 👨🏫 Get Students Assigned to a Mentor
- 📚 Assign Students to a Mentor
- 🔄 Update Mentor for a Student
- 🚧 Error Handling
- 🔐 Security
- 🤝 Contributing
- 📜 License
- Clone the repository:
git clone https://github.com/issei416/Student-Mentor-Backend-API.git
cd mentor-student-management
- Install dependencies:
npm install
- Set up environment variables: Create a .env file in the root directory and add the following:
MONGO_URL=your_mongodb_connection_string
PORT=your port number
- Start the server:
npm start
To use the API, you need to have a running instance of the server. You can interact with the API using tools like Postman or any HTTP client library in your preferred programming language.
👨🏫 Get Students Assigned to a Mentor
- Description: Retrieves a list of students assigned to a specific mentor.
- Method: GET
- URL: /mentors/:mentorId/students
- Request Parameters:
- Path Parameters:
- mentorId (string): The unique identifier of the mentor.
- Path Parameters:
- Responses:
- 200 OK: Successfully retrieved the list of assigned students.
- Content: An array of student objects.
- 404 Not Found: Mentor not found.
- 500 Internal Server Error: An error occurred on the server.
- Description: Assigns one or more students to a mentor.
- Method: PUT
- URL: /mentors/:mentorId/assign-students
- Request Parameters:
- Path Parameters:
- mentorId (string): The unique identifier of the mentor.
- Body Parameters:
- studentIds (array of strings): The unique identifiers of the students to be assigned.
- Path Parameters:
- Responses:
- 200 OK: Successfully assigned students to the mentor.
- 404 Not Found: Mentor or students not found.
- 500 Internal Server Error: An error occurred on the server.
- Description: Updates the mentor assigned to a specific student and records the previous mentor.
- Method: PUT
- URL: /students/:studentId/update-mentor
- Request Parameters:
- Path Parameters:
- studentId (string): The unique identifier of the student.
- Body Parameters:
- mentorId (string): The unique identifier of the new mentor.
- Path Parameters:
- Responses:
- 200 OK: Successfully updated the student's mentor.
- 404 Not Found: Student or mentor not found.
- 500 Internal Server Error: An error occurred on the server.
- 400 Bad Request: The request is malformed or missing required parameters.
- 404 Not Found: The specified resource (mentor or student) does not exist.
- 500 Internal Server Error: An unexpected error occurred on the server.
click here to visit the API docmunetation for this project.
click here to visit the deployed site.