This Faculty Management System is built using Node.js, Express.js, and Mongoose. It allows users to manage students and courses within a faculty. The system provides various functionalities including getting all students, getting a student by ID, adding a new student, deleting a student by ID, getting all courses, getting a course by ID, deleting a course by ID, and adding a new course.
-
Clone the repository:
git clone https://github.com/mahmudhmh/faculty-management-system-api.git
-
Navigate to the project directory:
cd faculty-management-system-api
-
Install dependencies:
npm install
-
Set up your MongoDB database.
-
Rename
.env.example
to.env
and provide the necessary environment variables likeDB_URL
for your MongoDB connection. -
Run the application:
nodemon server.js
- GET /api/students
- Returns a list of all students.
- GET /api/students/:id
- Returns a specific student by ID.
- POST /api/students
- Adds a new student. Requires JSON payload with student details.
- DELETE /api/students/:id
- Deletes a student by ID.
- GET /api/courses
- Returns a list of all courses.
- GET /api/courses/:id
- Returns a specific course by ID.
- POST /api/courses
- Adds a new course. Requires JSON payload with course details.
- DELETE /api/courses/:id
- Deletes a course by ID.
curl http://localhost:1312/api/students
curl http://localhost:1312/api/students/{id}
curl -X POST -H "Content-Type: application/json" -d '{"name": "John Doe", "dept": "OS"}' http://localhost:1312/api/students
curl -X DELETE http://localhost:1312/api/students/{id}
curl http://localhost:1312/api/courses
curl http://localhost:1312/api/courses/{id}
curl -X POST -H "Content-Type: application/json" -d '{"courseName": "Computer Science", "grade": "Very Good"}' http://localhost:1312/api/courses
curl -X DELETE http://localhost:1312/api/courses/{id}
This project is licensed under the MIT License.