
Learn how NodeJS provides an environment to run JavaScript outside the browser, built on Chrome's V8 engine since 2009, enabling full-stack development in JavaScript with a large community.
Confirm familiarity with basic HTML elements, simple CSS rules, and JavaScript concepts such as ES6, callbacks, promises, and async/await to follow this NodeJS course.
Explore the course structure by familiarizing with NodeJS and the dev setup, installing NodeJS, contrasting BrowserJS and NodeJS, mastering fundamentals, and introducing ExpressJS, then build NodeJS apps.
Learn to set up and customize your text editor for nodejs with visual studio code, including extensions, default config, and settings.json, via the VS-CODE-SETUP repo.
Fix video blur by selecting 720p in the settings cog when internet is slow. Transcripts may not match spoken words, and no fix exists for this issue.
Request concise course reviews to share what you like or dislike about the NodeJS Tutorial and Projects Course, helping the instructor improve future offerings with one or two sentences.
Compare browser JavaScript with Node.js, noting no browser APIs, DOM, or window object in Node, while Node.js offers file system access, OS info, and network responses with CommonJS modules.
Install Node.js by visiting nodejs.org, choose an LTS version, answer yes to the prompts, verify with node --version, and troubleshoot if needed; current version is acceptable for the tutorial.
Launch node in the terminal to enter the REPL, a read-eval-print loop for quick JavaScript experiments. Use CLI for real apps and exit with Ctrl-C.
Create a basic node project, write app.js with an amount variable and an if statement to log small or large numbers, then run with node app.js in VS Code terminal.
Visit johnsmilga.com to locate the Node Express tutorial project and clone, fork, or download the repo for our Express examples and assets.
Explore Node globals and global variables, compare with the browser window, and learn core globals like __dirname, __filename, require, module, process, console, and setInterval and setTimeout.
Discover how to organize a node app by splitting code from a single app.js into modules using CommonJS, improving structure and reusability across names and functions.
Explore node modules via CommonJS patterns, module.exports and exports, and require to share code across files. Learn to export functions and objects with relative paths to build modular apps.
Learn alternative syntax for exporting in node, including export as you go and module.exports patterns to expose single values, arrays, and objects with examples of items and a person.
Explore how built-in and third-party Node.js modules execute when required, by creating a mind-grenade example that invokes module code and logs the sum with a template string.
Explore Node.js built-in modules like os, path, fs, and http to set up a basic server, while learning general module usage and how to access official docs.
Explore the os built-in module in node to fetch current user info, system uptime, and memory details and see how to require and use its methods.
Learn to use node's path module to manage file paths across platforms with path.sep, path.join, path.basename, and path.resolve to produce normalized and absolute paths, using __dirname for absolute paths.
Explore the fs module in Node.js: read two text files with readFileSync, create and write a result file with writeFileSync, and understand overwriting versus upending using a content folder.
Learn to perform asynchronous file reads and writes in Node.js using readFile and writeFile with utf8 encoding, handling errors via callbacks.
Compare synchronous blocking code with asynchronous non-blocking patterns in Node.js using file read/write examples, and see why promises and async/await improve task flow.
Explore the HTTP module to see how server setup works and to visualize core Node.js features in action, with detailed syntax to come in later sections.
Set up a basic http server in Node using the built-in http module, create a server listening on port 5000, and respond with a welcome message to requests.
Learn the HTTP module basics, inspect the request URL to serve homepage and about pages, and fix multiple responses with return or if-else.
Explore how npm enables reusing code, managing packages and dependencies, and sharing solutions in Node.js projects. Assess package quality by weekly downloads and explore npmjs.com for ready-made solutions.
Explore the node package manager (npm) to install local and global dependencies, check the npm version, and learn npm install and npm i -g, with a preview of npx.
Create and manage package.json as the project manifest, using manual creation, npm init, or npm init -y. Install lodash and bootstrap with npm i to see them in node_modules.
Learn why package JSON matters for sharing code, and how to push to GitHub while excluding node modules, using gitignore, cloning, and running npm install to install dependencies.
install nodemon as a dev dependency to watch files and automatically restart the app, then use npm start for node app.js or npm run dev for nodemon app.js.
Learn to uninstall a package with npm uninstall, stop nodemon, and optionally remove node_modules and package-lock.json as a nuclear approach, then update package.json dependencies and reinstall with npm install.
Install packages globally using npm install -g, with sudo on mac, to run tools like nodemon anywhere. NPX offers a global-free alternative for CLI tools.
Explain why package-lock.json locks exact dependency versions to ensure a consistent setup across collaborators, and describe major, minor, and patch changes as a contract between users and package maintainers.
Master essential node topics like the event loop, async patterns, events emitter, and streams, using nodemon, to understand how node works before building your first express.js app.
Explore how the Node.js event loop enables non-blocking I/O by offloading work to the system kernel within a single-threaded JavaScript environment.
Explain how JavaScript runs on a single thread and how the browser offloads tasks with setTimeout and fetch. Show how the Node.js event loop registers callbacks to keep requests responsive.
Explore the node event loop with code examples, including asynchronous read file offloading to the file system, plus set timeout, set interval, and a server handling requests.
Learn asynchronous patterns in node js and why blocking code with nested callbacks disrupts the event loop, then adopt cleaner async approaches for building simple http servers.
Explore converting node fs readFile from callbacks to promises and async await, by wrapping readFile in a promise, handling errors with reject, and using then/catch for multiple reads.
Refactor to async patterns use promises and async/await to orchestrate file reads and writes, replacing nested callbacks with a start function wrapped in try/catch for clarity.
Learn to convert read file and write file callbacks into promises with Node's util.promisify, then use async/await for cleaner, readable code.
Explore events in Node.js and event-driven programming. Learn how to listen for specific events and register functions to respond, noting that built-in modules use events under the hood.
Create a Node.js event-driven example by importing the events module, instantiating an EventEmitter, and using on and emit to handle a 'response' event with a data received callback function.
Explore how an event emitter supports multiple listeners, the importance of listening before emitting, and passing arguments with emit to access them in callbacks.
Explore how the http module uses the event emitter pattern with server.on('request') to handle incoming requests, showing how built-in modules rely on events.
Master streams in Node.js by reading and writing sequentially to process continuous data or large files, including the four types writable, readable, duplex, and transform.
Learn how to read large files efficiently with Node.js streams by using fs.createReadStream, consuming data in 64 kilobyte chunks via the data event, avoiding full file memory loads.
Explore Node.js streams by adjusting read stream buffer with highWaterMark from default 64 kilobytes. Set encoding to utf8 and handle errors with the error event, noting 90 kilobytes and remainder.
Explore streaming large files with a node http server by using create read stream and pipe to the response, demonstrating chunked transfer instead of a single payload.
Celebrate completing section three of node fundamentals and apply your node knowledge by building servers, turning theory into practical server projects.
Learn how the web exchanges data through HTTP request and response messages, and why we use Node with Express to build a web server; grasp server vs cloud concepts.
Explore the structure of http messages, including start line, headers, blank line, and optional body, for requests and responses, with methods, URLs, and codes like 200 and 404.
Set up the starter project by cloning the Node Express Tutorial repo from johnsmilga.com, remove the .git folder to prevent permission errors, and prepare for future pushes.
Review the repository overview, including the express-tutorial folder and the final folder, and learn to install dependencies with npm install and start the express app with npm start.
Build a basic http server with the built-in node http module, using createServer to handle req and res and end the response while learning port concepts.
Learn to set http headers with res.writeHead, including status codes and a mime type, then send the body with res.write and res.end for correct rendering.
Discover how the HTTP request object exposes the method and URL to route resources, build home and about pages, and return 200 or 404 responses with proper content type.
Read the index.html file with fs.readFileSync at startup and pass its contents to the response. Set the correct content-type to serve HTML pages.
Demonstrate building a node http server to serve html, css, logo, and js, fix 404s, map resource paths, and introduce express for routing.
Explore Express.js, a flexible Node.js framework that speeds up building websites, apps, and APIs. Install with npm, pin to version 4 to avoid breaking changes, and consult expressjs.com docs.
Set up an Express server, import Express, create app, and define routes with app.get and app.use, including a 404 not found and 200 status responses.
Build a nav bar app with express, serving static assets from a public folder on port 5000 using express.static, sendFile, and path.resolve or dirname for index.html.
Learn to serve static assets with Express by placing index.html in the public folder, using middleware to serve static assets, and comparing send file versus template engine for rendering.
Compare api versus server side rendering in express by building an http api that returns json with res.json, and preview templates with res.render.
Learn to serve basic JSON data with express by returning an array of objects, such as tours, via res.json, and wire data for front-end fetches.
Create a get route for /api/products that returns a minimal collection (id, name, image) and teach route and query string parameters to fetch full details for a single product.
Implement Express route parameters to fetch a single product by id using req.params, convert the id to a number when needed, and return 404 when not found.
Demonstrate using route parameters like productID and reviewID, log request params, handle 404s, and introduce query string parameters in a Node.js app.
Use query string parameters in the url to filter and paginate results. Learn to read req.query, handle keys like search and limit, and return json data.
Learn to avoid server errors by returning in callbacks to ensure only one response per request. Handle query strings to filter products or return all products.
Explore how Express.js middleware sits between requests and responses, using a logger to log method, url, and date, and pass control with next.
Move the logger to a separate middleware file, export via module.exports, and import in app.js; then apply it to all routes with app.use, optionally under /api.
Learn to chain Express middleware with app.use, create an authorize middleware, control execution order, and attach user data to req while handling 401 unauthorized via a simple query string example.
Explore how middleware shapes Express apps by applying custom and built-in middleware with app.use, including per-route use and third-party options like morgan to log requests and authorize.
Master the get method in Express by reading data from a sample /api/people endpoint, and see how post, put, and delete manipulate the data without persisting it.
Explore setting up the post method in an express server, using app.use and express.static to serve the methods public assets, and testing with postman or insomnia for post requests.
Demonstrate how the POST method handles both form submissions and JavaScript requests to /login, parse urlencoded data with express middleware, access req.body, and return welcome or 401 credentials.
Explore posting data from a javascript front end with axios to a server API, handling content type, post requests, 201 success, 400 errors, and express json middleware.
Use Postman to quickly test your API routes, such as get and post on localhost:5000/api/people, by sending JSON bodies and inspecting responses like success: true and 400 bad request.
Use the PUT method to update a specific person at /api/people/:id, leveraging req.params and req.body, with map updating the in-memory array and a 200 success response.
Implement a delete method in Express to remove a person by id from api/people/:id, returning the updated list and a 200 status.
Learn how to use express router to group routes into route files under a routes folder for /api/people and login, adopting mvc style.
Create a controllers folder and build a people.js with get, create, update, and delete functions. Export functions with module.exports and route via controllers; compare router.route chaining to separate routes.
Begin with basic, topic-focused projects, gradually progressing to more complex tasks, and rely on lessons from earlier projects to master a big API project by following the recommended sequence.
Clone the repository with git, open it in your editor, and explore the node and express-tutorials directories, including final and starter. Then run npm install and follow project-specific setup.
Learn to set up and connect to a cloud database, persist data, and perform create, read, update, and delete operations via a backend API for a task manager.
Set up a Node task manager project by installing dependencies, configuring .env and MONGO_URI, and running npm start with nodemon; includes express, dotenv, and mongoose.
Navigate to starter folder for the task manager project, install packages with npm install, then start an express server on port 3000 with a /hello route using npm start.
Outline the general routes for the tasks API, including get all tasks, create a task, get a task by id, update, and delete under API version 1.
Explains the api route structure using domain forward slash api version one conventions and demonstrates get, post, patch, and delete on tasks. Covers versioning and the put versus patch distinction.
Set up a scalable Express API by creating a tasks router and controllers. Wire api/v1/tasks get route, use Express.json middleware, and return a simple 'all items' response to test.
Wire up crud task routes by creating controllers for create, get all, get single, update, and delete tasks, wire them to api version 1 routes, and test with Postman.
Set up and test a NodeJS API in Postman by creating a collection, configuring global variables for localhost and API version, and validating routes with get, post, patch, and delete.
Learn how rest defines an http interface for a NodeJS api, using crud operations on resources through get, post, put/patch, and delete, with json data.
Switch from in-memory arrays to MongoDB Atlas, a NoSQL database, storing data as JSON in collections and documents, and learn basic cloud setup with a free tier.
Set up MongoDB Atlas for cloud hosting by creating a free account, following the official docs checklist, and configuring a free cluster on AWS with a chosen region and name.
Set up Atlas database access by creating a read/write user and enabling network access from anywhere. Copy the connection string and configure your app in connect.js with an environment variable.
This NodeJS tutorial covers developing locally with allow access from anywhere or your IP address, then deploying to Heroku with allow from anywhere to connect to MongoDB, and DigitalOcean hosting.
Connect to MongoDB, create a database named store and a products collection, then insert documents with dynamic schemas. See how _id guarantees uniqueness and how Mongos can enforce structure.
Explore how to perform create, read, update, and delete in a GUI using a manual setup with a products collection, inserting, reading, updating, and removing documents.
Learn how to connect a Node.js server to MongoDB using Mongoose, an easy-to-use object data modeling library with a straightforward API; installation and version notes are discussed.
Set up a Mongoose connection in connect.js with a connection string, username, password, and database name, then test it in app.js and address deprecation warnings.
Refactor the database connection to start the server on port 3000 only after a successful mongoose connect, exporting a connect db function and using async/await with try-catch.
Set up a dot ENV file to store secrets like Mongo URI, load them with the dot ENV package, add dot git ignore, and access via process dot ENV.
Create a mongoose task schema with name (string) and completed (boolean), build a task model tied to a collection, export it for controller use, and set up env-based connection string.
Assign a mongoose task model from a schema and use await task.create with req.body to add a new document in the tasks collection, returning _id and __v.
Show how only schema-defined properties pass to the database, ignoring any extra fields. Test with Postman confirms that only name and completed are stored, enforcing document structure and data integrity.
Add validation by turning name into an object with type string, and applying required, trim, and max length 20, while setting completed default to false.
Learn to handle Mongoose validation errors with try/catch in async controllers, returning 500 server errors and concise JSON messages, while using await and improving user feedback for task creation.
Learn how to implement the getAllTasks controller in NodeJS using Mongoose find to retrieve all tasks, handle errors with try/catch, and return a JSON response with the tasks.
Learn to build a get task route with Mongoose findOne, retrieving a task by id from params, returning 200 with the task, 404 if not found, and 500 on error.
Explore how two errors appear in a node.js api: a 404 when no task matches id and a CastError when id format is valid but item is missing.
Implement the delete task route using findOne and delete, retrieve the task id from the request params, and return 200 on success or 404 if not found.
Learn to implement updateTask using findOneAndUpdate, retrieve id from params and data from body, and enable new:true and runValidators:true to return the updated task, tested via Postman.
Serve static files from the public folder with express.static and load a vanilla.js front end to /api/v1/task via axios post. Demonstrate adding, editing, deleting, and refetching tasks.
Compare put and patch methods for updating resources, showing that put replaces the whole item while patch updates only provided fields, and explain how override handles removed fields.
Explore how to structure NodeJS API responses, choosing between status, success flags, and data payloads, and align server responses with frontend expectations using axios.
Create a custom 404 middleware in an Express app by building a not-found module, exporting notFound, and wiring it with app.use to return a route does not exist message.
Create an async wrapper middleware to wrap express controllers, reducing repeated try-catch blocks and enabling error handling via next. Apply the pattern across routes, starting with get all tasks.
Build a custom Express error handler with a four-argument middleware at the end of the stack, using asyncWrapper to pass errors to a json 500 response.
Learn to create a custom error class extending Error, attach a 404 status, and route errors to a centralized handler using next, enabling precise not found responses in API endpoints.
Set the server port from process.env.port or default to 3000, enabling deployment across hosts. Test locally by overriding the port and running app.js to verify the selected port.
Celebrate completing the project in the NodeJS tutorial and projects course. Look forward to the next one as the instructor signs off.
Build a store API with advanced filtering, sorting, and dynamic database population. Let the backend handle search by name, price, category, and company; the frontend only issues HTTP calls.
Set up the NodeJS project with starter and final folders for work and reference. Understand the boilerplate structure and why extra steps beyond npm install save time.
Build a basic express app by installing dependencies, configuring dotenv, adding json middleware, and wiring not found and error handling, then create a home route and run on port 3000.
Connect your node.js express server to a database using Atlas connection string stored in dotenv with a Mongo_URI variable, then invoke Connect DB in App.js and restart with npm start.
Set up two express routes for products under api/v1, wired via a router and controllers for getAllProducts and getAllProductsStatic, including a manual testing route and a route returning dummy data.
Set up a new Postman collection, add two get routes for products and a static route, configure URLs with double curlies, test by sending requests, and save changes.
Learn to handle async errors in express apps by using the express-async-errors package: install, require in app.js, and throw errors to be caught by a custom error handler.
Create a product model using a Mongoose schema, defining name, price, featured, rating, created at, and a constrained company enum with custom error messages, then export the model.
Automatically populate the database with product data via populate.js, connecting to MongoDB, deleting existing products, creating new ones from jsonproducts, and exiting on success.
Learn to query products with Mongoose find, filter by featured or name, and test results using a get all products route with the product model.
Learn to use query params to dynamically filter data by passing req.query into the find function, and test with Postman to fetch featured products.
Learn how Mongoose v6 ignores nonmatching filter properties and applies only schema properties, unlike v5 which returned an empty array; consult the migration docs for details.
Refactor query handling by extracting only desired req.query properties into a queryObject, use a ternary to set featured, and pass the object to find to avoid bugs.
Explore building a NodeJS API that filters results by company and featured status, using query objects and Postman validation, with clear API documentation guiding usage.
Learn to search products by name in a NodeJS/Mongoose app, starting with exact matches and advancing to regex queries with case-insensitive options to filter all products.
Learn how to implement sorting in mongoose queries by name or price, including ascending and descending orders, multi-criteria sorting, and chaining with limit and get all products.
Implement sorting in getAllProducts by chaining sort after find and deferring await until the final query. Use a comma split, join with spaces, and default to created at.
Learn to use the select method to filter fields in a product query, by passing a fields list (name and price) and observing id, name, and price in the response.
Learn how to implement pagination with skip and limit to fetch specific pages of products, using defaults, and optionally sort results by name to display ordered pages.
Implement pagination on the get all products route by reading page and limit from req.query, applying defaults, converting to numbers, and chaining skip and limit with a calculated skip.
Set up numeric filters to search by number conditions, using price comparisons like greater than 30 or less than 30, and explore Mongoose query operators with sorting.
Extract numeric filters from the query string with a regex-driven operator map, converting price and rating conditions into Mongoose operators for product filtering.
Learn to implement numeric filters in an API by parsing options for price and rating, split, array destructuring, build a query using operators greater than and greater than or equals.
Finalize the numeric filters to complete the project, and look forward to the next lesson.
Learn how json web tokens restrict access to protected routes by requiring a valid token, demonstrated with login, token generation, and accessing user-specific data.
Set up starter and final folders, install dependencies, and run the Express server that uses dotenv, JWT basics, express-async-errors, and custom error handling to serve UI and API routes.
Set up login and register routes with Express and controllers, and build a dashboard that returns the user name, a secret, and a lucky number, illustrating JSON Web Token concepts.
Test a basic controller using Postman by creating a 05 JWT basics collection with routes for /dashboard and login, sending username and password as JSON and validating responses.
Validate username and password from the request body in a NodeJS login route, issue a JWT, and protect the dashboard with token-based authentication via CustomAPIError error handling.
Learn how public and restricted routes use a signed JSON web token to grant access, returning the token after credentials and validating it on each dashboard request to ensure integrity.
Explore the jwt structure—header, payload, and signature—base64url encoding, and how the server signs and decodes tokens to let the front end access user resources.
Explore signing and decoding tokens using the JSON Web Token package, focusing on two essential methods and a quick installation command for your Node.js projects.
Learn to issue a JSON web token in NodeJS app by importing JWT, signing a payload with id and username, a secret, and expiry, and returning the token on success.
Show how to use an Authorization header with a Bearer token to access protected data, store the token in localStorage, and attach it to subsequent Axios requests.
Learn to retrieve a token from a login request and send it as a bearer authorization header in Postman, validating the token before accessing user-specific resources.
Learn to validate the authorization header in a node app. Check existence, ensure it starts with Bearer, throw 401 for missing or invalid tokens, and extract the token for verification.
Verify a JSON web token (JWT) with a verify method using token and secret from process.env, handle 401 not authorized errors, and use the decoded username for responses.
Set up an authentication middleware for dashboard by creating an async function with req, res, and next. Export the middleware and apply it to protected routes to enforce authorization.
Implement a jsonwebtoken-based auth middleware that validates the authorization header and bearer token. Decode the token, attach id and username to req.user, and protect routes by calling next.
Create a base CustomAPIError and two subclasses—BadRequest and Unauthenticated—with hard-coded 400 and 401 status codes, export them via index.js, and import them in your app.
Learn to use the http status codes library in Node.js to replace numeric literals, improving readability and consistency by referencing status codes like bad request and unauthorized in error handling.
Refactor a nodejs app by updating the auth middleware, main controller, and error handler to use shared error classes from the errors module, simplify status codes, and test token-based access.
Build a jobs API that combines authentication with CRUD operations for managing job searches, using a JSON web token for login, deploying to Heroku, and documenting endpoints with Swagger UI.
Set up the jobs api by configuring .env with Mongo URI and JWT secret, installing dependencies, and running npm start for the starter or final project.
Set up a Node.js controllers module with auth and job CRUD routes, export controllers, and implement get all jobs, get job, create, update, and delete operations.
Set up express routes for auth and jobs by wiring routers and controllers. Define register and login, plus create, get, update, and delete operations, then export routers for app.js.
Connect a Node.js app to MongoDB by wiring the database connection in connect.js, using Mongo_URI and MONGO_URI, then verify listening on port 3000 and prepare authentication setup.
Create a mongoose user schema with validators for name, email, and password, including required, minlength, maxlength, email match, and a unique index, and export the model for registration.
set up the auth register route to validate name, email, and password, hash the password, create the user, generate an associated token, and return it in the response.
Validate user input in the controller by checking name, email, and password from req.body; throw BadRequestError for missing fields and leverage mongoose validators for meaningful error messages.
Hash passwords with bcryptjs to protect user data by combining the password with random bytes and hashing. This one-way hash changes with any input, enabling secure verification of passwords.
Hash a user password with bcryptjs by creating a tempUser from req.body, generating a salt with genSalt, then hashing the password before storing it in the database.
Apply mongoose middleware to securely hash passwords during user registration using pre save hooks, bcrypt salt generation, and async await, keeping controller logic clean.
Learn to generate a json web token in a node.js controller using jwt.sign, include user id and name in the payload, set a 30-day expiry, and send back the token.
Explore mongoose schema instance methods, create a get name and create JWT method to generate tokens on user registration, using payload with id and name and a 30-day expiry.
Configure json web tokens by setting expiresIn with default seconds or a unit-specified string, and securely load JWT_SECRET and JWT_LIFETIME from .env via process.env.
Create the login controller to validate email and password, fetch the user by email, return a JWT token and username on success, or 400/401 errors for credentials or unauthenticated access.
Add a user schema method that uses bcrypt.compare to verify a candidate password against the stored hash, returning a login token on success and invalid credentials on failure.
Set up an authentication middleware that validates a bearer token with json web token, attaches the user id (and name for testing) to req, and forwards to protected routes.
Apply an authentication middleware to protect all job routes with app.use in app.js. Test using token-based bearer authentication in Postman and verify req.user reflects the authenticated user.
Explain code paths for auth middleware, showing how to look up a user by token id with find by id or find one, and using select to omit the password.
Define a mongoose job model with company, position, status enum, and created by user, enabling timestamps and a create job route for a NodeJS rest api.
Create a job route that accepts company and position, attaches the authenticated user as created by, and uses the job model with validation, error handling, and mongoose timestamps.
Implement getAllJobs by filtering jobs to the current user with createdBy, sorting by createdAt, and returning both jobs and count after validating via the auth middleware using a bearer token.
Set a dynamic access token in Postman by extracting it from login responses, saving it as a global variable, and using it as a bearer token for requests.
Learn to implement get single job in a Node.js project by passing the job id as a route parameter, protecting with an access token, and testing with Postman.
Update a job via patch by reusing getJob logic and testing in Postman with a bearer token. Validate company and position, use findOneAndUpdate with new and runValidators, handle not found.
Implement delete job by wiring a delete route with authorization, locate by underscore id and user, remove via find one and remove, and return 200 after Postman tests.
This lecture teaches how to implement user-friendly Mongo error responses by enhancing the error handler with a custom error object, handling duplicate key errors with a 400 status.
Implement and validate a custom error in Node.js, leveraging a statusCode and message, remove unused checks, and verify a 400 bad request error in the login flow.
Handle registration validation errors by inspecting Mongoose errors, extract messages from the errors object with Object.values, map to messages, join them into a user-friendly string, and return a 400.
Explore how to handle cast errors in Node.js jobs controller, returning 404 not found for invalid ids and implementing a custom error response.
Deploy a Node.js app to Heroku and protect the API with Helmet, CORS, XSS-clean, and express-rate-limit, using middleware to guard against common web threats.
Import and apply helmet, cors, xss clean, and express-rate-limit as middleware, then configure a 15-minute rate limit and trust proxy for Heroku behind a reverse proxy.
Host your Node.js project on Heroku, and ensure MongoDB allows access from anywhere by whitelisting your IP, or your app will encounter errors.
Deploy your NodeJS project to Heroku and host online, noting the free tier is gone, then explore Render as a generous free tier alternative.
Deploy your Node.js project to the cloud with Heroku by signing up, installing git and the Heroku CLI, verifying setup, and preparing deployment with git init and commit.
Learn to deploy a Node.js app to Heroku by preparing the project, configuring env variables, adding a Procfile, pushing to Heroku, and testing with Postman.
Discover a fast path to working API docs by using Postman Docs and a third-party library to automate Swagger UI setup, avoiding lengthy manual configuration.
Learn to clone an existing Heroku app using the Heroku CLI and Git, set up a local environment with dot env, install dependencies, and run on port 5000.
Ensure all requests share the same global url variable in the collection. Export Postman docs as json to keep documentation on the same server.
Format postman json to be swagger ui compatible, then use apimatic to transform the data; sign up for a free apimatic account at apimatic.io to follow along.
Import the docs json into apimatic, configure server url and bearer token authentication, skip authentication for login and register, organize endpoints into auth and jobs, then export openapi v3 yaml.
Test Swagger editor docs by adjusting path and query parameters, authorize with a token, and register a user to create and fetch jobs.
Install and configure swagger ui in a NodeJS app using yamljs and swagger ui express, load the yaml file, expose docs at /api docs, and test with try it out.
Deploy NodeJS projects on Render by linking GitHub, and grasp free tier limits such as 750 hours per month, 15 minutes idle shutdown, 30-second startup, and 100 GB bandwidth.
Push your project to a separate GitHub repository to enable automatic redeployment by Render, then initialize, commit, set up gitignore, and push the changes.
Deploy a Node.js web service on render by connecting your GitHub repo, configuring environment variables, and using npm install and node app.js, with api docs.
build a server to power a front-end application using the jobs api, with added features and modifications, and explore the optional project through a live demo at redux-toolkit-jobster.netlify.app.
Set up the Jobster API project by installing dependencies, configuring .env with jwt lifetime 30 days, secret, and mongo uri, then run npm start to launch server on port 5000.
Perform spring cleaning by removing Swagger UI, YAML file, homepage, and API docs from the jobs API, switch to nodemon, set engines to node 16, and verify route not found.
Explore the client folder to set up a front end with a production-ready React app built by create react app, serving static assets via public and express static.
Set up the front-end by serving client/build with express static and path.resolve to the root, route non-api requests to index.html, and run the server on localhost:5000 for the landing page.
Modify the user model by adding last name and location with defaults, trimming, and a max length, enabling profile updates and syncing front-end profile changes with job locations.
Modify register and login controllers to return a single user object with email, last name, location, name, and token, aligning with front-end expectations.
Create a test user in the database and verify login via the demo account, using the front end to register and log in for end to end testing.
Set up a secured update user route using an authenticated patch request under auth/update-user, validating front-end inputs and wiring middleware to attach the user for checks.
Complete the update user controller by validating inputs, updating name, last name, email, and location, saving the user, and returning the full user object with a new jwt when needed.
Explore how updating a user with dot save triggers pre save hashing, causing the password to hash twice and logins to fail; learn to hash only when the password changes.
Extend the jobs model with a job type enum (full-time, part-time, remote, internship) and a default location. Implement full CRUD for user-tied jobs via the API and front end.
Generate fake job data with a mock data generator, export the data as json, map fields to the job model, and populate the database using a test user id.
Populate the database with mock data using populate.js, dotenv for the Mongo URI, and the Job model to create records from mockData, logging success and verifying via the front end.
Learn how to implement server-side filtering, searching, sorting, and pagination for user-specific jobs using a query object and regex on the position.
Implement the getAllJobs controller to fetch user-specific jobs, build a query from request query params, and apply a case-insensitive regex on the position field.
Build dynamic status and job type filters in a NodeJS app by constructing a queryObject that includes status when present and not equal to all, and similarly for jobType.
Explore implementing sort in a NodeJS app by chaining sort in the controller, using createdAt or position with latest, oldest, A to Z, and Z to A options before pagination.
Implement server-side pagination with limit and skip to return page-by-page jobs, compute total jobs and pages, and expose page and limit via the query.
Implement a test-user flag in the auth middleware by validating the jwt payload user id, then enforce read-only access on restricted routes for the demo account.
Implement a test user middleware in Node.js to restrict updateUser and job routes, blocking create, delete, and update operations with a BadRequestError when req.user is a test user.
Implement an express rate limiter for login and register routes using express-rate-limit, with a 15 minute window and configurable max, returning a front end friendly object with a message.
Learn to use the MongoDB aggregation pipeline to build a user-specific stats page that groups applications by status (pending, interview, declined) and totals from the last six months.
Create the showStats controller in the jobs module and wire a /stats get route, returning defaultStats as an empty object and monthlyApplications as an empty array.
Set up a status aggregation pipeline in a NodeJS project by installing moment, importing mongoose, and aggregating by userId and status to count results.
Refactor status data on the backend using reduce to convert an array into an object with status keys (pending, interview, decline) and counts, matching the front end's expected structure.
Build a monthly applications aggregation pipeline in Node.js, grouping by year and month to count apps and deliver front-end ready chart data for the last six months.
Refactor monthly applications data to match front-end expectations using moment.js for date formatting, map year and month to count, and reverse order for last-month display before deploying on Heroku.
Deploy the jobster API to render by consolidating the server and front end into one repo, removing the procfile, and adding a .env secret file.
Welcome to NodeJS Tutorial and Projects Course.
I guess let’s start by answering the most pressing question first. What is a NodeJS? And even though there are plenty of good answers out there the one that I like the most is this one - "NodeJS is an environment to run Javascript outside of the Browser". NodeJS was created in 2009 and it's built on top of Chrome's V8 Javascript Engine. As you are probably aware of, every browser has an engine, a tool that compiles our code down to machine code and Chrome uses one by the name of V8. Since the moment it was created, Node has evolved tremendously, and while there are many things to like about Node, some of the main ones are - large community, since that tremendously saves time on feature development, as well as the fact that with the help of Node, it's never been easier to build Full-Stack Apps, since both Front-End And Back-End are built in one language, and you guessed that language is our beloved Javascript.
During the course we will cover following main technologies - NodeJS, ExpressJS, MongoDB, Mongoose, JWT and many smaller ones as well.
Course consists of
- Node Tutorial
- Express Tutorial
- Projects
- Task Manager API
- Store API
- JWT Basics
- Jobs API
- File Upload
- Send Email
- Stripe Payment
- E-Commerce API
- Email Workflow