
Explore JavaScript fundamentals and beyond with an experienced software engineer who brings five years of industry practice, founder of coop, and mentor-led, step-by-step tutorials through articles and courses.
Explore how the JavaScript engine tokenizes code, builds an AST, performs semantic analysis, and uses a JIT compiler to generate machine code for execution, plus memory management and garbage collection.
Explore JavaScript's single threaded execution, the call stack, and a to do list of function calls, illustrated by logging sequences and the trains deadlock analogy.
Explore JavaScript engines and runtimes, including the V8 engine used by Chrome and Node.js, and learn how runtime environments extend ECMAScript with setTimeout and console.
Explore browser runtime specific APIs and the document object model, including querySelector, node lists, and converting to arrays with Array.from, to understand how the JavaScript runtime interacts with the DOM.
Explore how Node.js handles process events in the repl and observe the event-driven behavior of the process object, an event emitter, through uncaught exception and exit events.
Examine how the V8 engine uses a call stack to execute code, factorial recursion, and how the JavaScript runtime delegates asynchronous tasks via binding in Node.js and browsers.
Explore how Node.js blends JavaScript with Libuv to perform non blocking io, using fs promises to write test io dot txt and dns promises to resolve google.com, with error handling.
Explore how Node.js uses libuv to manage I/O through handles and requests, contrasting long lasting HTTP servers with short lived DNS lookups, for non blocking, scalable apps.
Explore how the Node.js event loop coordinates tasks, delegates I/O operations to the operating system sockets and the thread pool, and drives the request–response lifecycle with callbacks and non-blocking I/O.
Explore ecmascript feature compatibility across node versions using docker, test the find last method in node 17.9.1 versus 18.12.1, and consult node green and mdn for reference.
Master Node.js basics by exploring JavaScript fundamentals, syntax parsing, memory management, and the V8 engine, while comparing single-threaded and multithreaded environments, plus runtime environments, binding, external APIs, and Node.js features.
Learn how to use setTimeout to delay code execution in Node.js, manage timer IDs with clearTimeout, and compare zero-delay timeouts with setImmediate to keep the event loop responsive.
Explore the error-first callback pattern in Node.js to handle asynchronous file reads non-blocking and gracefully manage errors in real-world code.
Clarify the difference between synchronous and asynchronous callbacks in JavaScript, using reduce to show how an accumulator a and current value b form a sum.
Discover continuation passing style and how callbacks control flow in JavaScript, illustrated with a factorial in CPS versus traditional recursion.
Explore callback hell in Node.js, a pyramid of doom from deeply nested asynchronous operations like reading directories, DNS lookups, and reading and transforming files before writing output.
Mitigate callback hell by using a central error handler, exit early on errors, and modular functions for reader, DNS lookup, transformer, and writer to improve readability and maintainability.
Explore the sequential iterator pattern in Node.js to run a tasks array with a single iterator and callbacks, reducing callback hell and improving readability, maintainability, and non-blocking flow.
Explore how promises provide a cleaner approach to asynchronous code in Node.js. Use then and catch to handle fulfillment, rejection, and chained file operations, avoiding callback hell.
Create and manage a promise using the JavaScript promise constructor, an executor, and the resolve and reject functions to handle asynchronous operations with then, catch, fulfillment, and rejection.
Explore concurrency with promises in JavaScript by defining fetch user profile, settings, and posts, then compare Promise.all, Promise.allSettled, Promise.any, and Promise.race for asynchronous control.
Learn how to use the async/await pattern in Node.js to write cleaner promise-based code for file system tasks, including creating directories, writing files, and iterating directory contents with for await.
Master using try/catch with async/await to handle errors in NodeJS file operations, logging with console.error to prevent crashes.
Learn how an async function performs file operations using promises, await, and try-catch, including creating a temporary directory, writing files, iterating with for await of, and returning file names.
Wrap up highlights callbacks, callback hell, and modularized, early-exit patterns; then cover promises, async/await, error handling, and Node.js i/o and the worker pool.
Explore JavaScript modularity by refactoring a monolithic file into cohesive classes and utilities (math utils, date utils, API utils, validation utils), using closures and IIFEs to enforce encapsulation.
Discover how Node.js uses Commonjs modules loaded from the local file system for fast, network-free modularity. Use exports and require to share functionality across core, package, and local modules.
Master ES6 modules to organize modern JavaScript with strict mode, top-level exports, and clear imports. Use default and named exports, re-exporting, and namespace imports for maintainable code.
Explore JavaScript scope, including global, local, and block scopes, and learn how var, let, and const behave with hoisting and module exports and imports for code reuse.
Explore the Node.js path module to manage file paths with absolute and relative references. Learn base name, dirname, join, parse, relative, and path separator for cross-platform path handling.
Learn dynamic importing in Node.js to load modules on demand, improving performance and responsiveness through non-blocking, asynchronous imports and top-level await.
Explore core modules built into Node.js, focusing on the crypto module to perform hashing, encryption, and digital signatures with salt. Grasp public and private keys.
Explore real-world crypto techniques by hashing passwords with sha-256, creating hmac signatures, generating secure random tokens, using pbkdf2 salted hashes, and encrypting with cipher, initialization vector, and auth tag.
Navigate node package management with npm and yarn, create and manage package.json, track dependencies and scripts, and leverage semantic versioning for stable updates.
Wrap up this course by consolidating JavaScript modularization, covering Node.js modules, ES6 vs CommonJS, path handling, and dynamic importing, plus crypto hashing and encryption and external packages.
Explore the history of JavaScript from its 1995 creation by Brendan Eich at Netscape to its role in interactive web pages, highlighting vanilla JavaScript and the need for structure.
Explore how loose JSDoc documentation in vanilla JavaScript can become outdated or incomplete, and why code reviews, tests, and proper typing are essential for maintainable, scalable code.
Explore how TypeScript extends JavaScript with optional static typing and class definitions to catch errors earlier. Use the type checker, compiler, and language service for a better development experience.
Explore TypeScript in action by defining typed objects and functions, such as a person type and a greet function, and see compile-time error checks with interfaces and classes.
Install Node.js and TypeScript globally with npm, write code in a .ts file, compile with tsc to produce .js, and run with Node; create tsconfig.json to customize options.
TypeScript enforces type safety without imposing a specific code structure, letting you choose functional or object-oriented styles, while transpilation with Babel preserves modern JavaScript features.
Learn how TypeScript adds a typing layer to JavaScript by defining types such as number, string, boolean, null, undefined, big int, and symbol, enabling type inference and early compile-time checks.
Explore two core TypeScript errors—syntax errors and type errors—that arise from invalid code or type mismatches, and learn assignability checks that ensure values fit expected types before compilation.
Understand how evolving any lets variables adopt a new type as values change in TypeScript. Use type annotations and interfaces to enforce string, number, and object shapes, and learn how the compiler removes types to generate clean JavaScript.
Discover how TypeScript extends ECMAScript modules with import export and types to create modular, maintainable code, avoid global scope conflicts, and rely on ECMAScript modules over CommonJS for type inference.
Explore how union types in TypeScript allow a value to hold string or number, and see how narrowing and the pipe operator, plus explicit annotations, improve code safety and flexibility.
Explore how TypeScript enforces type safety with union types, restricts access to only shared properties, and uses assignment narrowing or conditional checks via if and typeof to access type-specific properties.
Explore TypeScript literal types that enforce strict type checking by defining exact values, using const inference, and treating primitive types as unions of literal values.
Explore how null references cause runtime errors and how TypeScript's strict null checks prevent them. Learn to use explicit types and union types like number or undefined to avoid crashes.
Learn how TypeScript type aliases create named representations for existing types, combine aliases into unions, and how they exist only in the type system, not runtime code.
Explore TypeScript object types by using object literals to define car properties, infer shapes, and enforce type safety with interfaces, aliases, and explicit declarations for compile-time type checking.
Explore how structural typing differs from duck typing, and learn how TypeScript enforces object shapes with type aliases and explicit interfaces to prevent type errors in NodeJS.
Explore how to declare optional properties in TypeScript with the ? modifier and distinguish them from required properties that may be undefined via union types, using practical object examples.
Explore TypeScript object handling by mastering union types, type narrowing, and optional chaining to write robust, type-safe code and safe access to shared properties.
Master discriminated unions in TypeScript by using a discriminant property to narrow types, represent loading, success, or error states, and implement type guards for animals.
Explore intersection types in TypeScript by combining two or more types with the ampersand, creating composite object types like shape and color, while avoiding primitive types and never type pitfalls.
Explore the never bottom type in TypeScript, showing how a function can be unreachable and never completes normally when a throw ends execution.
Explore how TypeScript enforces function parameters, including required vs optional, default values, rest parameters, and union types with undefined, contrasted with JavaScript.
Explore how TypeScript infers function return types, including unions of number or undefined for multiple returns, and how explicit number annotations enforce numeric returns and catch type errors.
Explore TypeScript’s advanced function types, including syntax resembling arrow functions with type annotations, using function types for callbacks, union and onion types, and type inference to enhance readability and maintainability.
Explore return types in TypeScript, comparing void, undefined, and never, with examples of ignored return values, infinite loops, and throwing errors to illustrate special cases.
Learn how TypeScript overload signatures define multiple function versions for string, number, or boolean inputs, ensure compatible implementation, and apply overloads sparingly for maintainability, illustrated by Addnumbers.
Explore how TypeScript enforces a single data type in arrays by tracking the initial type and restricting operations, demonstrated with string names arrays and number arrays.
Explore how TypeScript union types let array elements be string, number, or boolean, and learn to enforce typings with explicit annotations for string arrays and 2D arrays.
Understand how TypeScript handles array access and undefined values, and use the spread operator to concatenate arrays while observing union types and rest parameter type checks.
Learn how tuple arrays enforce a defined type at each index, preserving exact structure and preventing mismatched elements. Explore rest parameter tuples and tuple returns in functions.
Explore explicit tuple types and as const in TypeScript to create fixed-size, read-only tuples for point 2d, distance calculations, and safe destructuring.
Learn how TypeScript interfaces define object shapes, merge for flexibility, and improve type checking and performance when modeling classes and third-party code.
Explore how TypeScript interfaces define a shape and enable clearer error messages. Compare optional properties, read only modifiers, and interface member styles, including method, property syntax, and call signatures.
Learn how call signatures describe functions with custom properties in TypeScript. See index signatures enable dynamic key-value mappings, arbitrary keys, safety cautions, and map usage for robust data handling.
Explore TypeScript interfaces with nested properties, base and derived interfaces, and interface extension, including property overrides and multiple inheritance to model complex data.
Understand interface merging, where declarations with the same name in one scope merge into an interface with properties. It warns about type mismatches, overloads, and advises avoiding this pattern.
Explore how TypeScript defines and calls class methods and constructors with explicit property declarations. Learn about type checking, strict initialization, and using the exclamation mark to manage property readiness.
Explore class features in TypeScript for Node.js: optional properties, read-only fields, literal types, private fields, and safe access patterns using getters and constructors.
Learn how to declare that a class implements an interface using the implements keyword, enforce contracts, handle multiple interfaces, and note that TypeScript does not copy interface members onto class.
Explore how subclassing with extends enables inheritance of properties and methods in TypeScript, including overriding, super calls, and polymorphism, while ensuring type safety and substitutability.
Learn how to declare abstract classes and abstract methods in TypeScript, enforcing subclass implementations of get area and make sound, while abstract blueprints rely on concrete methods.
Explore true privacy in JavaScript and TypeScript by examining public, protected, and private modifiers, runtime errors for private access, and pitfalls from mixing legacy keywords with new private fields.
Explore how TypeScript uses the static keyword with visibility and read only modifiers to define class-level properties and methods, accessible via the class name without instantiation.
Explore TypeScript top types, contrast any and unknown, and learn how proper type safety prevents runtime errors by enforcing checks before using values of unknown or any type.
Learn how TypeScript type predicates use boolean checks to narrow an animal argument to a specific type, enabling cat-specific properties and behaviors like meow.
Explore TypeScript's keyof and typeof operators to create robust, type-safe access to object keys. Learn how to combine them to derive key unions and simplify data access.
Master TypeScript top types, type assertions, and guards to override type checks for dynamic data and third-party libraries, using the as keyword to trust a value's type.
Master non-null assertion in TypeScript to declare values are not null or undefined, enabling safe use without extra checks, and contrast type declarations with type assertions for stronger typing.
Explore how type assertions work in TypeScript, including safety between assignable types, the dangers of double type assertions, and using as const to create read-only tuples and literals.
Explore how generics in TypeScript capture type relationships to create reusable functions and classes, infer types, and swap or return first elements while addressing TSX limitations.
Explore TypeScript generics and arguments, learn how generic functions infer types from inputs like arrays and predicates, and when to use explicit type parameters (often 1–2) for readability.
Explore generic interfaces in TypeScript, using type parameters and type inference to build flexible, statically typed code with an example like pair and makePair.
Explore generic classes with type parameters in JavaScript and TypeScript, including a type parameter T for items in a collection, and using extends and explicit type arguments for precise typing.
Explore generic interfaces and a generic data storage array that implements the data storage interface with its own type parameter, enabling storage of strings, numbers, and objects.
Learn how TypeScript uses generic type aliases with type arguments to create arrays like Myarray<number> and Myarray<string>, and view a type alias my type<t> with my instance<string> logging Hello world.
Define a generic result type with success and data, using discriminated unions in TypeScript to represent database query outcomes and enable type-safe handling of data or error messages.
Explore generics with default type parameters and constraints, including extends and keyof, to craft flexible utilities like a pair type alias and a Getproperty function.
Learn to use promises and generics in TypeScript for safe, robust asynchronous code. The lecture covers explicit generic type arguments, then and catch, and async function return type inference.
Explore generics best practices in TypeScript, balancing flexibility with readability by using type parameters when necessary, naming them clearly, and applying them to generic functions like map and reverse array.
Learn the fundamentals of APIs, including what an API is, the first party, second party, and third party relationships, and key terms like resources, authentication, and authorization.
Discover HTTP fundamentals to master API communication, including requests and responses, status codes, methods (get, post, put, patch, delete), headers, and cookies for robust API development.
Compare REST and SOAP APIs, highlighting statelessness, HTTP-based interactions, and the role of WSDL in SOAP. Explore practical examples and differences to guide web service design.
Learn advanced HTTP and web service strategies, including cross-origin resource sharing, differences between web services and web APIs, HTTP status codes, and using insomnia to test APIs.
Dive into OAuth and the authorization framework to see how third party apps access user data with scopes and tokens, including the authorization server, endpoints, and grant types.
Clarify resource owner and client roles, authentication versus authorization, and OpenID Connect in OAuth. Implement authorization code flow with PKCE, secure token handling, refresh rotation, HTTPS, and minimal scopes.
Explore JSON in depth for API development, covering basics, JSON schema, validation tools, and comparisons with XML and YAML.
Set up a basic express app and implement a catalog API with CRUD operations, using routes, controllers, and a mock JSON database.
Learn how to integrate TypeScript into a Node.js project by installing TypeScript and type definitions, configuring tsconfig, and updating scripts to support dev with tsx and the build process.
Install ESLint for the TypeScript project, configure an ESLint config.js with JavaScript and TypeScript support via plugins, then move the app to a source folder and add a lint script.
Define a book model and TypeScript interface to manage books with in-memory data, using body parser middleware and updated controllers for create, find, and delete operations.
Configure rate limiting in an express app with the express rate limit middleware to guard APIs against DDoS and brute force attacks, using a ten-requests-per-minute limit.
Implement a global error handler with the http-errors package, centralizing error responses via a send HTTP error utility and try‑catch blocks for structured JSON errors.
Learn to secure block management routes with jwt authentication in nodejs by generating RSA keys, signing tokens, and protecting routes with a verify middleware for login and book operations.
Learn what node.js is, a cross-platform, open-source JavaScript runtime for server-side development, powered by npm for reusable packages, with asynchronous I/O and a single thread.
Install node.js by following official installation guidelines for your operating system, then verify with node -v and npm -v, using a terminal emulator on Windows, macOS, or Linux.
Explore the fundamentals of Node.js: what it is, why it matters, how it works, and key concepts like thread, V8, Libuv, event loop, Looptick, and Modules.
Create your first node.js app by building an http server in app.js, listening on port 5050, routing requests to specific paths like /admin and /user.
Discover how node.js uses the v8 engine and libuv to execute JavaScript and manage asynchronous code in a single threaded process via npm and the event loop.
Explore how Node.js achieves non-blocking I/O through libuv’s event loop, call stack, thread pool, and the message queue, with pbkdf2 examples and OS delegation.
Explore how the event loop progresses through tick iterations across timers, pending callbacks, poll, and check stages. Compare nextTick and setImmediate behavior and see how timers trigger callbacks.
Explore node.js modules, core, npm, and local, export and require functions, and build local modules with sum.js and index.js for simple routing.
Explore how to handle asynchronous JavaScript in Node.js using callbacks, promises, and async/await, and learn how to convert callbacks to promises.
Learn JSON format basics, including syntax, objects and arrays, with practical steps to create posts.json, understanding data interchange between files, database, and our app.
Define the callback pattern as a function passed into another and invoked to complete async code; simulate data retrieval for movies, reviews, and users via setTimeout and callbacks.
Explore the callback pattern in NodeJS by retrieving a review with movie_id using setTimeout, and then fetch the related user through nested callbacks.
Identify how callback hell arises from nested callbacks, making code inflexible and hard to read. See how the promise pattern arrives as the rescuer.
Understand the promise pattern as the completion or failure of an asynchronous operation. Create a new Promise with an arrow function, using resolve and reject.
Explore how to use a promise instance, then and catch methods, and handle fulfilment or rejection to avoid unhandled promise rejection, with console logging examples.
Convert callbacks to promises in a Node.js file, implement resolve and reject, and explore then, catch, and pending states while handling getMovie with id and not found errors.
Convert callbacks into promises, implement resolve and reject, and chain promises with then to avoid nested callbacks, achieving scalable, simple asynchronous code for movies, reviews, and users.
Explore how async/await simplifies promise handling by marking functions async, using an iffe pattern, and awaiting results to pause execution until the promise resolves.
Explore using async/await to fetch a movie review and reviewer data, handle errors with try/catch, and surface a user-friendly not found message for missing movie.
Convert a callback-based readFile example from the fs module into a promise using util.promisify. Handle success with then and errors with catch.
Explore the most important core modules built into Node.js, with no installation required for these built-in modules.
Learn how the event emitter works by creating a core module, importing the events module, and instantiating the eventEmitter class to attach an event listener and emit the event.
Learn to pass arguments from an emitter to a listener, greet a name, and attach multiple listeners to the same event, noting sync execution among listeners.
Explore how node.js uses the event emitter by building an http server that extends net server, registers a listening event, and uses setImmediate to run a listener asynchronously.
Learn to retrieve file metadata with fs.stat by promisifying it, then log the file status using then and catch.
Learn how the fs module is operated through the libuv engine, promisify the opendir method, and list current directory contents with async/await by iterating dirents and logging dirent.name.
Explore how node.js streams optimize data transfer by reading and writing in chunks using readable, writable, and duplex streams from the fs module with createReadStream, createWriteStream, and the pipe method.
Learn how to use open, readfile, and writeFile, promisify readFile, and ensure file existence, handle errors, and read or create files with utf8 encoding.
Explore the path module and learn how __dirname, __filename, and process.cwd locate the file being executed. See how __dirname points to the file's directory while process.cwd shows the parent path.
Explore duplex streams in Node.js by examining how sockets on an http server enable reading and writing, with a practical example using createServer, the connection event, and port 5000.
Explore the path module by using basename, extname, and parse to extract filename, extension, and path components, and log results to the console.
Join the path components with path.join to build cross-platform file paths across unix and windows. Use __dirname, module, and mod.js with fs.readFile and utf8 to read and log file content.
Explore npm, the Node.js package manager for open source libraries, and see how easy it is to integrate reusable code in your project; learn about Jest, a Facebook-created testing library.
Inspect the package.json file and its metadata, including name, version, description, homepage, and bugs field. Distinguish dependencies from devDependencies to control npm packages in production and development.
Create your package.json from scratch by running npm init, answer questions about name, version, description, entry point, repository, keywords, and author, then generate and open in your editor.
Explore npm commands to manage node packages: install with i, choose production or dev dependencies, review package.json and package-lock.json, inspect node_modules, and use npm list, --depth=0, and npm view.
Explore NodeJS basics to advanced dependency management, including semantic versioning with major, minor, and patch, upgrading deprecated dependencies with ncu and npm to install, update, and manage global dependencies.
Learn how HTTP enables client-server communication via request messages, including the request line, headers, and body, and explore methods like GET, POST, PUT, DELETE with Postman.
Explore how to craft HTTP responses, including status line, codes (200, 400s, 500s), headers such as content type, and a response body with key value data and tokens for authorization.
Explore how express, a node.js framework, builds http servers that respond to client requests. See how middlewares, routers, and handlers route /login requests to generate a response.
Learn to build a practical Node.js and Express app, connect MongoDB with Express, set up app.js and index.js, install Express, configure npm scripts, and run a server on port 5000.
Learn how to handle client requests in a NodeJS Express server using routes and the response object. Explore HTTP methods (get, post, put, delete), sending JSON, setting status, and redirects.
Use nodemon to watch files and automatically restart the server, replacing node in the start script; configure as a dev dependency and edit package.json so edits appear without manual restarts.
Learn to work with the request object in Node.js by accessing URL parameters with req.params, reading query data with req.query, and retrieving headers via req.get, including the host.
Explore how middlewares in express process requests using app.use, log the client IP address, and pass control to the next middleware or route with next to avoid hanging responses.
Restructure the app by creating middleware and routes modules, install and use morgan for logging, and refactor app.js to pass the express app to these modules for scalability.
Learn to build an express auth router that groups login and signup routes with get and post, modularized in auth.js and wired via app.use in routes/index.js.
Create a controllers module to organize route handlers, starting with auth/login in login.js; export and import getLogin, wire it to the route, building a scalable mvc API on port 5000.
Learn to build a scalable node.js logging system with Winston, configuring logger.js to log to a file at logs/infologs.log with levels like info and error.
Link Winston logger with Morgan to route http request logs from console to file via a custom stream. Expose the logger through a configuration module and test in production.
Set up a MongoDB cloud cluster, explore a replica set, and configure secure database and network access with read and write users for a NodeJS project.
Learn how to load a sample MongoDB dataset, explore the sample mflix database with collections such as movies, users, and comments, and understand the MongoDB structure from cluster to documents.
Create a reusable node.js database connection with the mongodb driver in db.js, using a _uri and MongoClient.connect, and expose a dbConnection function that uses a callback and closes the client.
Test a MongoDB database connection in Node.js by invoking the connection function, retrieving a movie from the movies collection with findOne, logging the result, and closing the connection in configuration/db.js.
Learn how to implement a paginated getMovies route in a Node.js app by wiring db.js, creating a movie router and a getMovies controller, and testing the endpoint at /movies?page=1.
Implement pagination in the movies controller by validating and parsing page param; on invalid input return 400, then fetch 10 movies per page with skip, limit, and respond with JSON.
Build a get one movie route in node.js using bson objectId to query MongoDB by id and return the movie or a 404 not found.
Learn to handle errors in a Node.js app by validating ids with bson's isValid, wrapping database calls in try/catch, and logging unhandled rejections to prevent server crashes.
Create a not found error handler in an express app using http-errors. Configure a 404 error for unmatched routes and pass it to a middleware to send the error response.
Create a global error handler in app.js using a four-argument middleware (error, req, res, next). Build errors with http-errors, log with the logger, and respond with status and json.
Learn to build a user model in nodejs by creating a models folder, defining a User class with a save method, and inserting into the users collection.
Define a user validator using hapi/joi in nodejs by installing @hapi/joi, building userValidator.js, and creating a joi schema with username, email, and a regex-based password, plus first_name and last_name.
Explore wiring and using a validator in the user model, exporting a validator module, and calling a static validate with userData to inspect value and password pattern errors in NodeJS.
Learn how to implement a NodeJS validation method validating username and password with regex, using default and custom messages, returning a result object and a validation variable.
Validate user existence before signup by invoking a checkExistence method that queries the database with an or condition on username and email, using findOne with async/await to prevent duplicates.
Build a signup post route and handle JSON input in an Express API. Expose a signup controller, wire it into routes, and enable JSON parsing with express.json.
Learn to build a signup controller in Node.js by implementing a user model, validating input with Joi, and handling errors via a custom 400 response using a global error handler.
Explore finishing the signup controller by checking user existence with a checkExistence method, handling 409 conflicts when email or username already exists, and routing errors to the global handler.
Learn to implement user creation in a Node.js route handler with callbacks, promises, and async/await, with existence checks, try/catch error handling, 201 created, joi validation, and postman testing.
Hash passwords before saving to the database using bcrypt.js. Use hashsync with 12 iterations to ensure secure storage, update userData.password, and test with postman.
Develop a login route by adding a user model static login method, validate username or email and password, and query the database for a matching user.
Build a login method that verifies user existence, returns a custom error for invalid credentials, and securely compares the input to the bcrypt-hashed password using compareSync.
Develop a login route and postLogin handler using the auth router and User.login, validate request data with Joi, and handle errors with http-errors, testing with Postman.
Use projection in the find query to return username and _id, improving performance. Generate a JWT on login with _id and username, using secret key from a private key file.
learn how to implement token-based authentication with jsonwebtoken, create an auth middleware to verify bearer tokens, and guard routes while handling errors with http-errors.
Develop and test a json web token middleware that decodes payload to populate req.user with user id and username, guards routes, and enforces 401 on unauthorized requests and 24h expiry.
Protect credentials by moving sensitive data to a .env file, load it with dotenv, and access values via process.env in your app, including the MongoDB uri and port.
Learn how to send email from your app using SendGrid, verify a sender address, and generate a node.js API key via the integration guide.
Configure Node.js email sending with SendGrid and an email.js helper. Build a message with from, to, subject, and html that injects username and a verify link to localhost.
Explore how to send email in a NodeJS app using a jwt token, exporting email function from configuration module and signing tokens with a private key, tested via Postman.
Implement email verification in a NodeJS app by adding a verified flag, creating a verification route and controller, validating the token with jwt, and updating the user record.
Learn to verify a user in NodeJS by updating the verified field with $set, handling modifiedCount and 404 errors, and confirming via email verification and jwt payload.
Create a comment model with Comment.js, data, created_at, modified_at; validate the body with Joi; and save to the comments collection using promises.
Create a comments route in NodeJS by setting up router, a post comment path for movieId, wiring the controller, and protecting with auth middleware for user data.
Validate movieId with ObjectId.isValid and handle errors with http-errors during comment creation. Validate text with Comment.validate, then save the comment via a promise secured by auth middleware.
builds comment edit and delete routes in nodejs by implementing static edit and delete methods using updateOne and deleteOne on the comments collection, with validation and auth guarded routes.
Fix a bug by converting a validated hex string to an objectId, switching routes to put for edit, and updating the modified date with MongoDB's $currentDate.
learn how to link movie and comment data by storing the latest 10 comments in the movie document, using $push with $each and $slice for efficient retrieval.
Link a new comment to a movie using insertOne and its insertedId, add it to the movie's comments array, and cap at ten by removing the oldest entry from the array.
Fix a bug by validating collection 2 in the database configuration and using a let outside the block to pass the value or undefined to the callback, preventing mongodb error.
Implement the getComments route to paginate comments by movieId and page, with auth guard, returning 10 per page sorted by createdAt, validating ids and handling errors.
Test the getComment route using Postman with a login token, supply the movie id, and explore paginated comments from page 1 to 2 after starting the server.
Guard the movie details route with auth middleware while removing it from the getMovies route to let all users view movies, making the app ready.
Dive deep into the world of NodeJS with this comprehensive course designed to take you from the basics to advanced concepts. Whether you're a beginner or looking to refine your skills, this course will provide you with a solid understanding of JavaScript fundamentals and their application in NodeJS.
We begin by exploring JavaScript engines, covering syntax parsing, compilation, memory handling, and garbage collection. You’ll learn about the differences between single-threaded and multi-threaded processes and get an introduction to the V8 engine, which powers NodeJS. Understanding the runtime environment and external APIs is crucial, and we will differentiate between JavaScript engines and runtime, emphasizing the concept of binding.
Next, we delve into NodeJS architecture and its compatibility with node green. We will cover callbacks and their role in asynchronous programming, addressing common issues like callback hell and providing strategies to overcome them. You'll become proficient in using Promises, including the Promise API, and mastering sequential and concurrent execution. Async/Await will be introduced for cleaner asynchronous code, along with try..catch and limited parallel execution patterns.
You'll also learn about async handling methods in NodeJS, understanding the Worker Pool, and handling I/O operations asynchronously. We'll compare blocking and non-blocking I/O in NodeJS, understand core modularization, and explore the necessity of separating files into modules. You'll get an in-depth look at ES6 and CommonJS modules, handling Intellisense limitations with `require` syntax, and explaining relative and absolute paths.
Moreover, this course covers core modules, third-party modules, local files, and lazy importing in NodeJS. You’ll gain practical knowledge of the File System (fs) Module in NodeJS, including writing files synchronously without overwriting. We will also compare NodeJS with browser runtimes like ReactJS and introduce you to external JS packages. Finally, you'll learn to configure ESLint for NodeJS projects, ensuring your code is clean and maintainable.
Join us and unlock the full potential of NodeJS, equipping yourself with the skills needed to build efficient, scalable, and maintainable applications.