How ankit6098/lectureshedulingbackend works
Project type and purpose
• This is a backend REST API built with Node.js and Express, using MongoDB (via Mongoose) for persistence.
• It provides administrative endpoints for managing “courses,” “lectures,” and “instructor assignments” in an educational scheduling context.
File structure
Top-level directories and files:
• config/
– environment.js (loads .env vars, e.g. mongoUrl)
– mongoose.js (connects to MongoDB)
• controllers/
– admin_Controller.js
– assignLecture_Controller.js
– course_Controller.js
– lecture_controller.js
– user_Controller.js
• models/
– AssignLecture.js
– Course.js
– Lecture.js
– User.js
• routes/
– admin.js
– index.js (root router)
• index.js (app entry point)
• package.json / .gitignore
Pattern:
– MVC-style separation:
Models → Mongoose schemas
Controllers → business logic and CRUD operations
Routes → HTTP endpoint definitions
– A single monolithic service exposing RESTful endpoints
README for additional insights
• Describes API endpoints for course/lecture management
• Requires a secure login feature (likely in user_Controller/admin_Controller)
• Hosted on Render at https://lectureshedulingbackend.onrender.com/
Detailed breakdown of components
• Config Layer:
– Load .env (mongoUrl)
– Initialize Mongoose connection
• Web Server: index.js
– Middleware (bodyParser, auth checks)
– Mount routers from routes/index.js
• Routing Layer: routes/index.js
– /api/admin → routes/admin.js
– /courses, /lectures, /users, /assignments → respective controllers
• Controller Layer:
– Methods: createCourse(), getAllLectures(), assignLectureToInstructor(), etc.
• Model Layer:
– Schemas: Course { title, description, … }, Lecture { date, topic, … }, AssignLecture { lectureId, userId }, User { name, role, passwordHash }
• Database: MongoDB cluster