
Explore the academic features of the school management api, including internal user roles (admin, teachers, students), staff registration and suspension, exams, published results, and student exam attempts with grading remarks.
Explore essential tools for the NodeJs API project. Use Visual Studio Code with Prettier and MongoDB extensions, Night or So theme, Postman for API testing, and structure the project folders.
Outline the project structure using the mvc pattern, with app, config, controller, middleware, and model (academic and staff) folders, plus routes and utils, and set up server.js and arp.js.
Initialize the project with npm, install express, mongoose, and jsonwebtoken, configure package.json, set up an express server with morgan logging, then run with nodemon for live restarts.
Recreate the server with the Node.js core http module, separating server from app logic, export the app, and prepare for future socket.io functionality.
Model the admin as a school staff member using a mongoose schema with required name, email, and password fields, a raw field to distinguish roles, and automatic timestamps.
Create the programs model in mongoose with required name and description, a default four-year duration, auto-generated code from the name, and references to creator, teachers, and subject.
Create a subject model with name and description, reference teachers and academic term, include admin model creator, allow multiple subjects per teacher, set duration to three months, and compile schema.
Define the academic year model with name, from year, to year, and is current, linking to the admin module and tracking students and teachers for the school management system.
Define the academic term model with name, description, and a configurable duration. Include a created by field for the admin who creates terms and compile the schema into the model.
Develop the year group model with graduation year and academic year fields, plus a created by admin field, using the source code in the academic folder and a compiled schema.
Create the class levels model for a school management system, defining level names like 100, 200, 300, and 400, and track counts of students, subjects, and teachers.
Builds a teachers model as part of the staff employment module for a school management system, defining login credentials, date employed, teacher id, subject, program, class level, and exams created.
Create a student model that an admin can add; manage student details, login options, class levels, academic year, exam results, and promotion, graduation, and withdrawal statuses.
Teachers learn to create exams, questions, and results within the exams model, defining name, description, subject, program, pass mark, total mark, and duration.
Explore the questions model in the nodejs api project, defining a question name, options A–D, the correct answer, is correct, and that a teacher can create questions for front-end styling.
Describe an exams results reporting model linking a student to examinations, including questions, grade, score, pass mark, status, remarks, and publication flag; focus on admin authentication and staff registration.
Create a database connection function using Mongoose to connect to MongoDB, handling success and error messages with try/catch, and auto-invoking the connection from the config before the server starts.
Set up a MongoDB Atlas cluster and user, enable universal IP access, and copy the connection string. Replace the username, password, and database name with LMS, then verify the connection.
Learn to secure your node.js API by using environment variables with dotenv to hide the Mongo URL and access it via process.env, then ensure a successful db connection.
Visualize your MongoDB data inside Visual Studio Code by installing the MongoDB extension, adding a connection with your connection string, and viewing collections such as default admin and looker.
Explore the mvc design pattern in a node.js app, with the model storing data, the view handling the UI, and the controller coordinating data flow and business logic.
Develop admin functionality in a nodejs mvc architecture by wiring routes for register, login, list/update/delete admins, and suspend/withdraw teachers, plus publish exam results using Morgan.
Test admin endpoints with postman by creating a workspace and collection, covering register admin, login, get admins, update, delete, suspend or withdraw teacher, and publish exam.
Learn to use Postman environments to manage the base URL across development and production. Create an LMS-dev environment with a base URL variable and reference it in requests.
Refactor the app to the MVC design pattern by adopting express routing with routers for academics and staff, centralizing logic in route handlers and using app.use to register admin routes.
This lecture completes the mvc pattern by moving admin business logic from the router into an admin controller. It exports multiple admin operations—register, login, suspend, publish—and documents their routes.
Implement the admin registration controller using the admin module and model to create admins and prevent duplicate emails; enable express.json parsing and return 201 on success.
Hash the admin password with bcryptjs in a mongoose pre-save middleware, store the hashed value in the database, and rehash only when the password field is modified.
Build admin login controller to authenticate by email and password, implement a verify password method on the admin schema with bcrypt compare, and return json responses for success and errors.
Explore Express middleware and how it accesses the request and response objects to implement authorization, logging with Morgan, error handling, rate limiting, and data validation across a school management API.
Discover how Express middleware enforces authorization by checking login, account verification, and admin or teacher or student roles, with next guiding the pipeline to the server.
Build and apply custom express middleware by creating a logger, authentication (is locked in), and admin-check modules. Chain them with app.use, use next, and test with requests.
Learn to implement error handling in a Node.js API project by using express-async-handler to catch async errors and replace try-catch blocks.
Implement a custom global error handler in Express using four-argument middleware to return a json response with message, stack, status, and errors.
Refactor the global error handler by creating a dedicated global-error-handler.js file in the metaverse, export the handler, and integrate it in the app with app.use.
Implement a not found route handler in a NodeJs API project, creating a not found error and forwarding it to the global error handler, then test with a non-existent endpoint.
Implement an is locked in middleware to verify user authentication, attach the user to the request for protected endpoints, and adopt JSON web token-based authentication for stateless sessions.
Explore how JSON web tokens work as an open standard for securely representing claims, including decoding, verifying, and generating tokens, signing payloads, and token based authentication.
Generate a token using json web token by signing a payload with the user id and expires in five days, then integrate it into the login flow.
Verify login tokens using json web token in node.js by creating a verify function with jwt.verify, handling invalid tokens, and using the decoded payload to authorize the user.
Learn how to pass a bearer token in the authorization header and verify it using isLoggedIn middleware. Attach the authenticated user to req.user to protect endpoints.
Develop the admin profile endpoint after authentication and authorization, fetching the admin by request.user.id via an async handler, excluding password and timestamps, and returning the admin data.
Modify the admin model to track actions by storing references to academic term, academic year, class level, teachers, and students, and update the admin controller to emit messages and tokens.
Create an async fetch all admins controller that returns admins with a 200 json and the message admins fetched successfully, protected by bearer token authentication and admin access.
Learn how to save and reuse an admin token in Postman by creating a token variable, configuring request headers, and validating protected endpoints.
Create a single is admin middleware that verifies a logged-in user as admin by querying the admin model with the user id and enforcing access control for any user.
Build an admin profile update controller in a Node.js API. Validate email uniqueness, update name, email, and password, and return the updated admin data with proper authorization.
Fix login error after updating passwords by hashing the password in the controller and verifying it during login, addressing Mongoose previous save middleware not triggering on put or updates.
Refactor the user update flow to hash the password only when it changes, validate email existence, remove redundant errors, and introduce a reusable helper to hash and verify passwords.
Refactor password handling by introducing hash password and is password matched helpers in the utils, export them, and integrate them into the admin controller for registration, login, and password updates.
Create an academic year in the Node.js school management API by building a controller, validating existence, and saving name, from year, to year, and created by admin middleware.
Create a get all academic years endpoint by building an academic year controller, using a find method to return all records, with route documentation.
Create a get single academic year controller and route using the id from params.id, secure it with token authentication and admin check, and prepare for updating the academic year.
Develop a controller to update an academic year in a Node.js API, verify by id, prevent duplicate names, and return the updated record via a put request.
Build a delete academic year endpoint in the NodeJs api for school management system by deleting the record found by id from request params and returning academic year deleted successfully.
Associate an academic year with an admin by pushing the created year id into the admin's academic years array, then save and populate to display full data.
Learn express routes chaining by refactoring with a common path and router.use to combine post, get, put, and delete handlers in the school management system API.
Develop a full academic term CRUD controller in a Node.js school management API by duplicating the academic year controller, defining the term model, and implementing create, read, update, delete.
Set up the academic term router in the NodeJs API, wire create, get all, get single, update, and delete endpoints, and protect with admin authentication via token.
Builds a class level CRUD controller in a NodeJs API, including creating, fetching, updating, and deleting class levels, with pagination, admin association, and routing patterns.
Create and manage school programs with a Node.js programs controller, integrating the program model, and implementing endpoints for create, get all, get one, update, and delete, with pagination.
Build a subjects CRUD controller in a Node.js API for a school management system, enabling create, get, update, and delete of subjects under a program.
Build a year groups controller for the school management api, implementing create, fetch all, fetch single, update, and delete, with admin linkage and academic year handling.
Admin registers a teacher via /admin/teachers/register with name, email, and password. Teacher starts pending until approval, after which admin assigns program, class level, and year for course and examination creation.
Build a teacher login flow by creating a login controller, validating email and password, and returning a token at the teachers/login endpoint.
Implement a teacher login middleware to verify the logged-in user as a teacher, adapting the admin middleware and switching from the admin model to the teacher model.
Implement an admin-only controller to fetch all teachers, enforce access control with admin authentication, and test with admin vs non-admin tokens.
Build an admin-restricted endpoint to fetch a single teacher by ID, using the route teachers/{teacherId}/admin, with error handling for not found and token-based access control.
Build a get /profile endpoint with a controller that returns the authenticated teacher's profile, accessible only to teachers (admin cannot view), and omit the password from the response.
Create a teacher update profile feature with two endpoints: teachers update their own details (email, name, password) and an admin can assign classes, subjects, or students.
Admin assigns programs, classes, academic year, and subjects to teachers through the update teacher controller, with admin-only access and automatic creation of examinations.
Create a teacher-driven exam creation feature in a Node.js api project, including an exams controller, exams model, and a payload for name, subject, program, academic term, and academic year.
Mount the examination controller and define exam route with teacher authentication to enable creating exams using a payload for name, term, year, class, duration, date, time, type, subject, and program.
Create an exam controller to fetch all exams via a get exams endpoint, wiring routes in the root academics exam module.
Develop a controller to fetch a single exam by id within the school management system exams route, using an exam router and a teachers-only access gate.
develop a Node.js exam update flow by adding an update exam method in the examination controller, validating the exam name, using a put request to exams/{id}, and returning 'exam updated'.
The "Nodejs School Management System API course" is a comprehensive and hands-on course designed to teach students how to build a fully functional school management system API using Node.js. The course is intended for developers, programmers, and anyone interested in building robust and efficient web applications.
Throughout the course, students will learn how to use Node.js and its various modules to create a RESTful API that can handle all the necessary functionality for a school management system. Students will learn how to create endpoints, handle routing, and interact with a database using MongoDB. They will also learn how to implement security measures such as authentication and authorization to protect the API from unauthorized access.
The course will cover a wide range of topics including Node.js fundamentals, Express.js, MongoDB, and RESTful API development. Students will also learn how to test their API using a tool called Postman.
By the end of the course, students will have a solid understanding of how to build and deploy a production-ready school management system API.
In addition to the technical aspects of the course, students will also learn how to design a scalable and maintainable API architecture. They will learn how to design the database schema and handle database migrations.
This course is ideal for students who have some basic programming experience and are looking to improve their skills in building web applications. By the end of the course, students will have developed a strong foundation in Node.js, MongoDB, and RESTful API development, and will be well-prepared to build their own school management system API or any other web applications.