
This course includes our updated coding exercises so you can practice your skills as you learn.
See a demo
Learn to build scalable REST APIs with Node.js, Express, and MongoDB, including a job API with authentication, authorization, error handling, radius search, aggregation, and deployment to Heroku.
Discover what Node.js is, why we need it, and where it is used, highlighting the V8 engine, event-driven non-blocking i/o, and real-time backend API use cases.
Set up your nodejs environment by installing nodejs, configuring the system path, and using Visual Studio Code with Git Bash, then verify installation with node -v and simple node commands.
Learn to run your first Node.js app in the terminal by creating index.js, logging a vanilla JavaScript variable with console.log, and using a for loop.
Explore behind the scenes of Node.js, highlighting its c++ dependencies like the V8 engine and libuv, and key libraries such as http, cares, openssl, and xlib that enable asynchronous I/O.
Explore how callbacks in Node.js provide non-blocking, asynchronous execution by passing a callback to tasks like reading files, and handling completion.
Explore the Node.js event loop, the heart of the runtime, and learn how a single thread schedules callbacks, setTimeout, setInterval, and setImmediate.
Explore how Node.js runs on a single thread with an event loop. A four-thread thread pool offloads heavy tasks like file systems and compression to avoid blocking.
Explore event driven architecture in Node.js using event emitters, event listeners, and callbacks, demonstrated through a coding example with emit and on.
Learn the basics of API and RESTful API, including how APIs let apps communicate, the constraints of REST (client-server, stateless, resource-based URLs), HTTP methods, and JSON data.
Discover how building a RESTful API enables data to be sent as Json to web, Android, iOS, Windows, and Mac apps, so a single backend powers multiple platforms.
Build your first web server with the http module, handling headers, body, and request and response, then test with Postman on port 3000 while exploring RESTful API basics.
Install Postman and learn to test your API by sending get requests to localhost:3000, create an account, and explore Postman's HTTP methods for API development.
Explore HTTP status codes and their five classes—informational, successful, redirection, client errors, and server errors—illustrated with key codes like 200, 201, 204, 301, 302, 400, 404, and 500.
Create a node http server and send a json payload with JSON.stringify, returning a data array of users, a success flag, and note the content-type header.
Learn how to use http headers in Node.js to control response data, including content type, content language, and date, and add custom headers like X powered by.
Learn how to use the request object in Express to access headers, url params, query strings, and request bodies, and implement get and post routes with express.json.
Set up a basic node.js rest api for jobs by initializing npm, creating app.js with express, and configuring dotenv via a config.env with port 3000 and development mode.
Install nodemon as a dev dependency and add dev and prod scripts in package.json. Run in development mode with nodemon for restarts, and set NODE_ENV to production for production mode.
Set up a basic express route in jobs.js, export the router, and wire it into the main app with api-v1, testing via postman.
Create a dedicated jobs controller with a getJobs method, export it, and wire it to the /api/v1/jobs route using router.route().get. Learn to separate router and controller logic.
Set up a Postman environment and collection for the node.js REST API, create a domain variable, and save a get all jobs request under a jobs folder, preparing API documentation.
Install and set up MongoDB community server on macOS using Homebrew, install Xcode command line tools, and verify the setup with the mongo shell to view databases.
Install MongoDB community server on Windows, download the community setup, the MongoDB shell, and MongoDB compass, then configure the path and start mongod to connect and view databases.
connect your Node.js RESTful API to a MongoDB database using mongoose, environment configs, and a local uri, then verify the connection in the app and MongoDB compass.
Create a middleware function that runs on every request, logs a message, sets a global request.user, and is activated with app.use while using next to continue.
Create a Mongoose job model with fields like title, description, email, company, industry, salary, posting and last dates, using validator and slug concepts.
Create and save new job data to the database via /api/v1/job/new post route, using the job model, request body parsing, and validator-based input validation with async/await.
Learn to auto generate slugs for job entries by using a mongoose pre-save hook with the slugify package; convert titles to lowercase dashed slugs before saving to the database.
Learn to implement a get all jobs route in a Node.js RESTful API, fetch all jobs from the database, tailor the response by hiding fields, and verify with postman.
Set up a location model with coordinates and address fields, geocode addresses to latitude and longitude using MapQuest, and save city, state, zip, country for radius-based job search.
Implement a get jobs in radius route that searches by zip and distance. Geocode the zip to latitude and longitude, compute radius, and query MongoDB with geo within center sphere.
Update a job by finding it by id and applying body data with validators, via put to /api/v1/jobs/:id, returning the updated job or a not found message.
Delete a job by id in a Node.js REST API, handle not found errors, and remove the job from the database (with upcoming file cleanup and authentication considerations).
Learn to create a get single job route in Node.js by id and slug, returning a 200 with the job data or a 404 not found, with proper request params.
Create a topic statistics route using MongoDB aggregation to compute average salary and positions, plus min and max salaries, by text-matching the topic in titles and exposing /api/v1/stats/:topic.
Create an error handler class in the utils folder that extends the error class, accepts a message and status code, exports the class, and captures the stack trace.
Implement a Node.js error middleware that exports a four-parameter function, sets a status code and message (default 500), and responds with a json object indicating failure.
Learn to separate development and production errors using a dedicated error handler and environment checks, exposing full stacks in development but concise messages in production.
Implement a global async error handler by wrapping all routes with catch-async-errors middleware to deliver proper messages in production and full error stacks in development.
Detect and handle unhandled promise rejections in Node.js by wiring process.on('unhandledRejection'), log the error, and gracefully shut down the server with server.close and process.exit.
Learn to handle uncaught exceptions and unhandled promise rejections in node.js using a top-level error handler, logging the error, and exiting the process; also provide proper responses for invalid routes.
Handle unhandled routes by returning a json not found message with a 404 status after all routes. Wire app.all and an error handler, and test with Postman for robust responses.
Learn to handle wrong mongoose object id and validation errors by customizing production messages, using an error handler to present all validation messages and set appropriate status codes.
Identify and fix runtime errors in a Node.js RESTful API by correcting error handling, status codes, and model validation messages. Apply the error handler across all controller methods.
Learn to build a reusable API filters class in Node.js to add advanced filtering to a get all jobs route, supporting salary operators and location queries.
Apply sorting to filtered results, using a sort field in the query, supporting single and multiple fields, removing sort field from the query, and defaulting to posting date when unspecified.
Implement field limiting in a jobs API using a fields query and mongoose select to return only specified fields like id and title, and hide the __v field by default.
Implement search by query in a Node.js RESTful API by parsing the q parameter, replacing dashes with spaces, and matching keywords in the job title, paving the way for pagination.
Add pagination with page and limit, defaulting to page 1 and limit 10, compute skip as (page-1)*limit, and apply mongoose skip and limit.
Create a user model with name, unique email, and role, plus a password, using mongoose for authentication. Validate input, default role to user, and hide the password, preparing for encryption.
Register a new user via the auth controller and hash the password with bcrypt in a mongoose pre-save hook. Prepare for generating a Json web token in the next video.
Generate a json web token (jwt) to authenticate users by signing the user id with a secret key and expiry using jwt.sign in node, with secret and expiry in config.
Learn to build a login route in api v1, validate email and password, verify credentials with bcrypt, generate a json web token, and return a secure token or errors.
Learn to store a jwt token in an http only cookie, verify it on requests, and expire the cookie after seven days for secure authentication.
Authenticate and protect routes by implementing a JWT-based auth middleware that validates a Bearer token, sets request.user, and allows only authenticated users to create jobs.
Learn to store the login JWT token in Postman automatically, save it to an environment variable, and use it in the authorization header to protect routes and enable role-based access.
Learn to restrict job creation by implementing an authorize roles middleware in Node.js, allowing only employer and admin roles after authentication, and returning clear errors for unauthorized users.
Add the user to a job by storing the user's object id in the job model, forming a relationship between employer and job. Attach the current user id before saving.
Learn forgot password flow in node.js by generating a reset token with crypto, hashing it, setting a 30-minute expiry, and preparing an email recovery link.
In this Node.js rest API masterclass lecture, learn to generate and store a password reset token and send a recovery link via Node Mailer using mailtrap SMTP.
Learn to implement a secure reset password flow in Node.js by hashing tokens, validating expiry, updating the user password, and issuing a new token via a RESTful API.
Handle wrong jwt token and jwt expired token errors in a node.js rest api with an errors middleware, producing clear json web token messages in production.
Logout user by clearing the authentication cookie and token, expiring the cookie instantly, and returning a 200 response with logs out successfully on the /api/v1/logout route for authenticated users.
If you want to build powerful, scalable RESTful APIs using the latest technologies like Nodejs, Express, and MongoDB, you are at the right place. This course is all about RESTful APIs development with modern technologies.
Why do I learn Node.js?
Do you know how much node.js developers make in the USA per annum?
According to Indeed, Node.js developers earn around $126,000 per annum with exclusive benefits. Isn't that amazing to learn Node.js?
Node.js is one of the best and hot technology right now in the market to build powerful REST APIs. Express.js & MongoDB help to make API quickly and efficiently. You can easily make super fast API with little effort with nodejs.
This course contains up-to-date videos of Node technology that will take you from the very basic level to the advanced stage, where you will be able to make modern and scalable RESTful APIs.
Like my previous courses, this course is full of exciting projects. We have to build a powerful JOB API in this course that will help you to learn APIs in Node, Express & MongoDB practically. A lot of practical exciting stuff is included in this course so that you can get 100% of this course.
=== Super Fiendly Support ===
If you ever get stuck in any problem, I'm here to unstuck you. I always respond as fast as I can. Because I know there’s nothing worse than getting stuck into problems, especially programming problems. So, I am always here to support you.
WHAT WE WILL COVER IN THIS COURSE?
Build modern, fast, and scalable RESTful API with NodeJS
Learn all about Advance Error Handling in Express
Learn all about advanced filters, sorting, pagination, and more
Handling File Uploads
Learn advanced authentication and authorization
Learn all about API Security like: Data Sanitization, Limiting Request, HTTP Header Pollution
Learn Advanced Mongoose Queries
Learn How to make API Documentation
Unit Testing
e2e Testing
Test Drriven Development [TDD]
Deploy on Heroku
So in the end, I am ready to teach all the exciting stuff to you right in the course. Click Enroll and I will see you inside the course.
See you!