Question: 1 . Project Setup Set up a new Node.js project. Initialize npm and install necessary dependencies ( express , mysql 2 , express - session,

1. Project Setup
Set up a new Node.js project.
Initialize npm and install necessary dependencies (express, mysql2, express-session, bcrypt, etc.).
2. Database Design (INCLUDE THE SQL FILE YOU ARE USING TO CREATE THE DATABASE AND THE TABLES!!!!)
Create a MySQL database name it CMS with the following tables: 1. users: For staff members. 2. students: For student information. 3. courses: For course details. 4. faculty: For faculty information. 5. enrollments: To store student/course and faculty/course associations.
Database Tables Structure
1.usersTable:
Columns: - user_id (INT, PRIMARY KEY, AUTO_INCREMENT)- username (VARCHAR(50), UNIQUE, NOT NULL)- password (VARCHAR(255), NOT NULL)- role (ENUM('admin', 'staff'), NOT NULL)
2.studentsTable:
Columns: - student_id (INT, PRIMARY KEY, AUTO_INCREMENT)- first_name (VARCHAR(50), NOT NULL)- last_name (VARCHAR(50), NOT NULL)- email (VARCHAR(100), UNIQUE, NOT NULL)
3.coursesTable:
Columns: - course_id (INT, PRIMARY KEY, AUTO_INCREMENT)- course_name (VARCHAR(100), NOT NULL)- credits (INT, NOT NULL)
4.facultyTable:
Columns: - faculty_id (INT, PRIMARY KEY, AUTO_INCREMENT)- first_name (VARCHAR(50), NOT NULL)- last_name (VARCHAR(50), NOT NULL)- email (VARCHAR(100), UNIQUE, NOT NULL)
5.enrollmentsTable:
Columns: - enrollment_id (INT, PRIMARY KEY, AUTO_INCREMENT)- student_id (INT, FOREIGN KEY REFERENCES students(student_id))- faculty_id (INT, FOREIGN KEY REFERENCES faculty(faculty_id))- course_id (INT, FOREIGN KEY REFERENCES courses(course_id))
3. Database Connection
Implement a connection to the MySQL database using the mysql2 library.
4. RESTful APIs
Implement RESTful APIs for each entity (users, students, courses, faculty, enrollments).- Use Express.js for routing. - Include CRUD operations for each entity. - Utilize MySQL queries for database interactions.
5. User Authentication
Use bcrypt to hash and verify passwords.
Create a simple login/logout mechanism using Express sessions.
6. User Sessions
Implement user sessions for tracking authenticated users.
Create middleware to protect certain routes from unauthorized access.
7. Views
Implement the following views using a template engine like EJS.
Views for Users:
List Users View: Display a list of all users.
Add User View: Form for adding a new user.
Edit User View: Form for editing user details.
Delete User View: Confirmation for deleting a user.
Views for Students:
List Students View: Display a list of all students.
Add Student View: Form for adding a new student.
Edit Student View: Form for editing student details.
Delete Student View: Confirmation for deleting a student.
Views for Courses:
List Courses View: Display a list of all courses.
Add Course View: Form for adding a new course.
Edit Course View: Form for editing course details.
Delete Course View: Confirmation for deleting a course.
Views for Faculty:
List Faculty View: Display a list of all faculty members.
Add Faculty View: Form for adding a new faculty member.
Edit Faculty View: Form for editing faculty details.
Delete Faculty View: Confirmation for deleting a faculty member.
Views for Enrollments:
List Enrollments View: Display a list of all enrollments.
Enroll Student View: Form for enrolling a student in a course.
Enroll Faculty View: Form for assigning a faculty member to a course.
Withdraw Student View: Confirmation for withdrawing a student from a course.
Remove Faculty View: Confirmation for removing a faculty member from a course.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!