-
Install Node.js. ( Link : https://nodejs.org/en/download/prebuilt-installer )
-
Set up a MongoDB Community Server and MongoDB Compass in your system. BELOW LINKS WILL AUTOMATICALLY STARTS DOWNLOADING THE REQUIRED SOFTWARE , JUST CLICK ON IT
- MongoDB Community Server Link : https://fastdl.mongodb.org/windows/mongodb-windows-x86_64-8.0.3-signed.msi
- MongoDB Compass Link : https://downloads.mongodb.com/compass/mongodb-compass-1.44.7-win32-x64.exe
-
Create a Cloudinary account. ( Link : https://cloudinary.com/users/register_free )
-
Install POSTMAN. ( Link : https://www.postman.com/downloads/ )
-
Clone the repository
-
Install dependencies -
npm install
-
Edit the config.env file in the root directory, configure the following variables:
- DATABASE_URL=YOUR_DATABASE_URL_HERE
- CLOUDINARY_CLOUD_NAME=YOUR_CLOUDINARY_CLOUD_NAME_HERE
- CLOUDINARY_API_KEY=YOUR_CLOUDINARY_API_KEY_HERE
- CLOUDINARY_API_SECRET=YOUR_CLOUDINARY_API_SECRET_HERE
-
Run the Server with Command :
npx nodemon
-
Access the application:
- Open POSTMAN and go to localhost:3000
Note: The first admin will be created automatically.Check your console.
-
Login
Endpoint:/admin/login
(POST)
Request Body:{ "email": "admin@example.com", "password": "admin123" }
-
Logout
Endpoint:/admin/logout
(GET)
For ADD, UPDATE, and DELETE operations, ADMIN authentication is required.
Endpoint:
/teacher/allteacher/:page
(GET)
- Description: Retrieves all teachers with pagination.
- Parameters:
:page
(optional): Page number. If left blank, defaults to1
.
- Example:
/teacher/allteacher/1
Endpoint:
/teacher/getteacherbyid/:id
(GET)
- Description: Retrieves teacher details by their unique ID.
- Parameters:
:id
(mandatory): The unique identifier of the teacher.
- Example:
/teacher/getteacherbyid/12345
Endpoint:
/teacher/addteacher/
(POST)
- Description: Adds a new teacher to the system.
- Request Body (form-data):
{ "name": "", // Teacher's name "email": "", // Teacher's email "subject": "", // Teacher's subject expertise "file": "" // Teacher's image (type: file) }
Endpoint:
/teacher/updateteacherbyid/:id/
(PUT)
- Description: Updates the details of an existing teacher.
- Parameters:
:id
(mandatory): The unique identifier of the teacher.
- Request Body (form-data):
{ "name": "", // Updated name of the teacher "email": "", // Updated email of the teacher "subject": "", // Updated subject expertise "file": "" // Updated image of the teacher (type: file) }
Endpoint:
/teacher/deleteteacherbyid/:id
(DELETE)
- Description: Soft deletes a teacher by marking them inactive instead of permanently removing them from the system.
- Parameters:
:id
(mandatory): The unique identifier of the teacher.
- Example:
/teacher/deleteteacherbyid/12345
For ADD, UPDATE, and DELETE operations, ADMIN authentication is required.
Endpoint:
/class/allclass/
(GET)
- Description: Retrieves all classes.
Endpoint:
/class/getclassbyid/:id
(GET)
- Description: Retrieves class details by their unique ID.
- Parameters:
:id
(mandatory): The unique identifier of the class.
- Example:
/class/getclassbyid/12345
Endpoint:
/class/addclass/
(POST)
- Description: Adds a new class to the system.
- Request Body:
{ "name": "", // Class name "teacherId": "", // Referencing teacher Id "studentCount": "", // Class student count }
Endpoint:
/class/updateclassbyid/:id/
(PUT)
- Description: Updates the details of an existing class.
- Parameters:
:id
(mandatory): The unique identifier of the class.
- Request Body:
{ "name": "", // Class name "teacherId": "", // Referencing teacher Id "studentCount": "", // Class student count }
Endpoint:
/class/deleteclassbyid/:id
(DELETE)
- Description: Deletes a class permanently.
- Parameters:
:id
(mandatory): The unique identifier of the class.
- Example:
/class/deleteclassbyid/12345
For ADD, UPDATE, and DELETE operations, ADMIN authentication is required.
Endpoint:
student/allstudent/:classId/:page
(GET)
- Description: Retrieves all student with pagination and class filteration.
- Parameters:
:classId
(mandatory pass- "all"): Class Id for filtering students. If filtering not required just pass "all" (mandatory):page
: Page number. If left blank, defaults to1
.
- Example:
student/allstudent/all/1
- Display all students.student/allstudent/12345/1
- Display the filtered student only.
Endpoint:
/student/getstudentbyid/:id
(GET)
- Description: Retrieves student details by their unique ID.
- Parameters:
:id
(mandatory): The unique identifier of the student.
- Example:
/student/getstudentbyid/12345
Endpoint:
/student/addstudent/
(POST)
- Description: Adds a new student to the system.
- Request Body (form-data):
{ "name": "", // student's name "email": "", // student's email "classId": "", // Refering class's Id "file": "" // student's image (type: file) }
Endpoint:
/student/updatestudentbyid/:id/
(PUT)
- Description: Updates the details of an existing student.
- Parameters:
:id
(mandatory): The unique identifier of the student.
- Request Body (form-data):
{ "name": "", // Updated name of the student "email": "", // Updated email of the student "subject": "", // Updated Refering class's Id "file": "" // Updated image of the student (type: file) }
Endpoint:
/student/deletestudentbyid/:id
(DELETE)
- Description: Soft deletes a student by marking them inactive instead of permanently removing them from the system.
- Parameters:
:id
(mandatory): The unique identifier of the student.
- Example:
/student/deletestudentbyid/12345
-
JWT-based authentication for admin access.
- Implemented secure authentication for admin access.
-
Protect routes to ensure only authorized users can perform operations.
- Restricted ADD, UPDATE, and DELETE operations to authorized admins for all models.
-
Allow uploading and updating profile images for students and teachers using Cloudinary.
- Enabled profile image upload and updates for students and teachers via Cloudinary, managed by admins.
- Optimized image URLs stored in the database for efficient retrieval
- Automatically deletes old images from Cloudinary when updating profiles of students/teachers.
-
Handle common errors like duplicate entries, invalid data, etc.
- Implemented validations to handle duplicate entries, invalid data, and common errors.
- Acknowledges room for further improvements in error handling.
Contributions, issues, and feature requests are welcome!