This is a simple API for managing courses, teachers, and booklets using Node.js, Express, and MySQL.
- Find Courses: Search for courses by name.
- Find Course Teachers: Get the list of teachers for a specific course.
- Find Course Booklets: Retrieve booklets for a specific course and teacher.
-
Clone the repository:
-
Install the dependencies:
npm install
-
Create a
.env
file in the root directory and add your database configuration:DB_HOST=your-database-host DB_USER=your-database-user DB_PASS=your-database-password DB_NAME=your-database-name APP_PORT=your-app-port
-
Start the server:
npm start
- URL:
/api/findCourses
- Method:
GET
- Query Parameters:
courseName
(string) - Response:
{ "message": "find courses successfully!", "courses": [...] }
- URL:
/api/findCourseTeachers
- Method:
GET
- Query Parameters:
courseId
(number) - Response:
{ "message": "find teachers successfully!", "teachers": [...] }
- URL:
/api/findCourseBooklets
- Method:
GET
- Query Parameters:
courseId
(number),teacherId
(number) - Response:
{ "message": "find booklet successfully!", "booklets": [...] }
- Parameterized queries to prevent SQL Injection.
- Helmet middleware for enhanced HTTP security.
- Error handling improvements.
- SSL enabled for secure database connections.
This project is licensed under the MIT License.