
This lecture introduces the content of this course. By learning with real world exemples, this course will help you to become comfortable with advanced concepts in Node.js in particular and web development in general. Besides Node.js, this course will introduce you to Docker, Angular, Gulp, Mocha (unit test) and PM2.
Install node.js from nodejs.org by downloading the current OS version and running executable. Verify in the terminal and use the interactive mode to create a variable and log its value.
Install Visual Studio Code as the recommended lightweight text editor with an integrated terminal, enabling you to write and run JavaScript files, navigate directories, and debug efficiently.
A small introduction on how to use Node.js with the terminal/command line
This lesson is a quick introduction to functions in Java Script
A quick introductions to object in Java Script
This lessons explains how functions in Java Script can be treated as first-class object
Despite what many people say, write or believe, there is no class as such in Java Script. This lesson explains how to simulate class behaviour in Java Script.
Despite what many people say, write or believe, there is no class as such in Java Script. Inheritance in Java Script such as in Java or C# does not exist in Java Script. Instead, Java Script uses prototype inheritance.
This lessons explains how to use the keyword "class" in Java Script, and what is happening under the hood. Because even though the keyword is "class", remember that there is no class in Java Script!
Learn how var and let differ in scope from global to block, and see how this affects functions, loops, and memory to reduce bugs and reuse names safely.
Understand that in JavaScript the this keyword refers to the calling context, not a class instance, often pointing to the global object and binding via function calls and prototype inheritance.
Understand strict mode in JavaScript, which forbids global variables and enforces declarations with var or let. Add 'use strict' at the top of file to enable it and prevent globals.
Learn how callbacks enable asynchronous JavaScript by passing a function to run after a delay, using setTimeout to simulate server responses and handle data in a callback.
Learn how to handle errors in Node.js callbacks using the error-first convention, where the callback receives an error parameter first and, if no error, the data is processed.
Learn how promises replace callbacks to manage asynchronous tasks in JavaScript. Create a promise, resolve with data, or reject on error, and use then and catch to handle outcomes.
Learn how to chain promises in Node.js by using then and catch to manage multiple asynchronous tasks, handle errors, and apply Promise.all for parallel execution.
Learn how to convert promises to readable code using the async and await pattern, wrapping asynchronous tasks in a synchronous style, with proper error handling via try, catch, and reject.
Learn how require loads dependencies, executes a module once, and caches its exports, so subsequent requires reuse the same object from the same location, as shown with two example modules.
Learn to capture user input in a command line app using the readline module, create a terminal input and output interface, and handle line events with on.
Install commander and set up a node.js cli project with an indexed entry point. Use npm install to add dependencies and parse arguments, including version output, with commander.
Create a library command line interface with book, user, and rent commands, each accepting author and year options, parsing arguments to perform actions - note no database yet.
Turn our Node.js application into a real command line tool by adding a bin folder, a shebang, and executable permissions, then install it globally to use via the terminal.
Create your first module in node.js by building a launch function and exporting it through a library module. Prepare for file system work and future database integration.
Learn to use the node fs module to save a json database with books, users, and rents to a file. Reading from the file appears in the next video.
Learn how to read a database file with the fs module, handle utf-8 encoding, parse content into memory, use callbacks to launch the program, and prepare for promise-based refactoring.
Learn to promisify a callback-based Node.js app by converting file operations into promises, handling errors with reject and resolve, and refactoring for readability and modular layer architecture.
Divide the application into a layered architecture to organize code, preventing spaghetti code, with a command line interface, controllers, and a separate database layer that abstracts data access.
Learn to implement the factory pattern in the node.js model layer, creating functions like createBook and createRent within a src/model folder for a layered architecture.
Initialize the database module to read and write to a file, expose only the necessary functions, and cache a connected object so subsequent calls reuse it.
Implement add functions for books and users, validate duplication in the database, and return a structured response; manage rentals with rent objects and persist changes.
Build and organize node.js controllers for users, books, and rents, validating input and delegating to a database layer through promise-based operations.
Explore how the Node.js event loop handles asynchronous tasks with callbacks on a single thread, and why blocking delays responses. See how non-blocking database and file system calls prevent stalls.
Explore the behavior of node timing functions setImmediate, setTimeout, and process.nextTick, and learn how their scheduling influences the execution order of callbacks in the event loop.
Learn how events in JavaScript are messages emitted by objects, such as line events when a line prints, and how multiple handlers run in the order added.
Learn how to create a bookshop object that inherits from event emitter, emit sale and register events, and manage listeners, with once and remove strategies.
Spawn a child process with fork to run long tasks without blocking the event loop, using event emitters and interprocess messages to keep Express routes responsive.
Explore how Node.js streams transform data on the fly, including turning text into caps and duplex streams that handle input and output, with memory-efficient file copy.
Explore how readable streams in Node.js manage data with an internal buffer and high watermark, contrasting pull and flow modes, and handling data with read calls or data events.
Learn how writable streams work with readable sources, buffering and writing data, decoding chunks with a string decoder, and using the pipe operator to connect streams in Node.js.
Explore how the pipe operator connects a readable stream to a writable stream, piping data automatically from reader to writer and simplifying the flow into a custom pipeline.
Learn how duplex streams enable simultaneous writing and reading through writer and reader buffers, and transform streams that convert data, using the transform function and pipe operator.
Explore socket communication with the net module by creating a simple server and client that exchange data over a duplex socket, decode to utf-8, and handle post and get requests.
Create a basic http server from scratch using the http module, handling requests and responses as streams, and route them with a switch while preparing for express-based apis.
Discover how Docker packages apps and dependencies into portable containers that run on any OS without extra installs. Learn how the Docker engine and containers differ from virtual machines.
Build a node-based docker image from a base node image, install dependencies with npm install, expose port 9000, and run it with port mapping to access the app locally.
Run CouchDB in a Docker container using the official image, configure the CouchDB user and password via environment variables, and map ports to access the dashboard.
Learn to create a CouchDB database, design a design document with a tropical view, and use map and reduce functions to query and index documents efficiently.
Define and deploy a list function in a design document to query a view using a weight parameter. Include docs, disable reduce, and format the resulting items for output.
Create a validate document function to enforce rules before adding new documents to the database, checking document type and allowed values like fruit and tropical.
Learn how to download and install Postman on Windows, macOS, or Linux, then explore the Postman interface and begin using it to build your API.
Build an api with Express by creating a project, defining a get route that returns hello, and a post route that decodes the request body to utf-8 and parses json.
Explore express middleware and the next function, and learn how requests flow through ordered middleware, parse the body into req, and short-circuit the pipeline with a response.
Create an Express server with a router, using regular expression routes, parameterized routes, and query parameters. Access req.params and req.query, and run on port 8000 with /api.
Design a node.js API with Express by building an API router. Define routes to fetch all books, fetch a book by id, create and delete resources, and prefix with /api.
Learn how to set up Mocha and Chai, write test specs with describe and it, and use assert, expect, and should to verify simple functions like hello and add.
Install gulp CLI globally and set up gulp in your project, then create a gulpfile.js and configure a sample task in package.json to see how gulp.js manages tasks.
Learn how to use environment variables and configuration in node.js, setting and accessing values across dev and production. Use a config module with default and environment-specific files to override settings.
Configure a library API database with Docker, map ports, set env vars, run CouchDB, create design docs and views for books, rent, and users.
Create and organize node.js database models, including book and user models, using factory functions and a uuid for IDs, then wire an index module and a standardized database response.
Implement the create operation of CRUD by adding a function that inserts a book into the database, uses async/await with try/catch, and checks library design document view to avoid duplicates.
Implement read operations in the Node.js CRUD module by author: query the books view, include documents, and use list by author to retrieve books by a given author.
Master CRUD in Node.js by implementing update and delete operations with a reusable document function, handling revision numbers, and enforcing checks before deleting books or users.
Explore logging with Winston in Node.js by creating reusable loggers, applying formats and transports, and logging info and errors to files for debugging and monitoring.
Implement a book controller in Node.js using class syntax, connect to the data layer, handle create and get operations with the database module, and return secure controller responses.
Implement a user controller modeled after the book controller with create, delete, and get. Validate IDs with the validator module, remove password and revision, then return user and export controller.
Build an API to fetch all books and add search functionality using query parameters to filter by title or author, with proper controller integration and response handling.
Learn to build a book API by implementing a post /books route, using body-parser middleware, validating title and year, and wiring controllers, models, and database for clean separation of concerns.
Create a user via post with email and password, using the user controller to return the new user and expose a get-by-id api route for retrieval.
Build an api for renting by creating a rent post, including user id and book id, handled by the rent controller, and awaiting a success response.
Learn how cookies maintain application state in Node.js and Express by setting and reading cookies, using a cookie parser, and signing cookies with a secret to securely personalize user sessions.
Learn how JSON web tokens sign data with header, payload, and signature to prevent tampering, and implement a token-based authentication flow with middleware guarding routes.
Implement a secure login flow by hashing passwords with a salt, querying users by email, and issuing a token after validating credentials in the api.
Install Angular globally with npm, verify the installation using the command line, and prepare to start building your UI.
Create the first menu component in Angular with TypeScript, featuring a Bootstrap navigation bar, a title/author search, and keyup event handling to update the query.
Define routes with path and component, declare new components, and wire router links and a router outlet to enable navigation and routing tracing in an Angular app.
Create two Angular services and use dependency injection with an http client to manage books and users via the API and observables.
Add a new user through a form using a user service, sending email and password via an observable and subscribe, then verify database entry.
Initialize a component with a book service to fetch all books from the database and display them in a table with title, author, and actions, including returning rented books.
Create an advanced book component with a form for title, author, and year, wiring a create book function to a book service and routing to add and manage books.
Add a parameterized route to load a book by ID, display its title and year, and enable renting or returning via template and service interactions.
Implement a search service that holds results as a subject of books, queries by title or author via HTTP GET, and displays clickable results in the search results component.
Create a login component that binds email and password via input events, calls the user service login, and navigates to home on a successful login.
Learn how to serve static files with Express.js by configuring the static middleware to expose a public directory, map file requests, and deliver scripts and assets to the client.
Integrate the Angular UI with the Node.js app by building the library, serving static files from distribution folder, and loading the compiled JavaScript into production, with route guards for authorization.
Explore angular routing guards using CanActivate to protect routes with a user service, enforcing authorization while keeping home and login accessible.
Compare backend routes and Angular routes, and how browser requests interact with router links. Implement solutions: redirect unknown routes to the homepage, or use server-side regular expressions.
This course will teach you, with real world exemples, how to write CLI and back-end web services with Node.js. Taking a software engineer approach (I'm a software engineer myself), this course will make you a Node.js master, but will also teach you architectural patterns, design patterns and concepts such as streams, event emitter, authentication, etc. You will also have the opportunity to use high-demand tools and technologies such as Docker, CouchDB, Gulp, Mocha and Angular. In this course, we will use those tools to help us build our applications. I'm also always available for any questions you might have during this course, and even after.