0%

Learn Node.js

node logo

Unit 1: Overview of Node.js Learning Path

Unit 2: Installing Node.js, npm, and VSCode

Install Node and Npm

  1. Install from nodejs.org

  2. Install Node & Npm via node version manager (nvm)

  3. Use Npx

Unit 3: A tour of Node.js

Node.js Architecture

Node.js is a JavaScript runtime built on Chrome V8 JavaScript engine.

node architecture

ECMAScript Standard

Read-Eval-Print-Loop (REPL)

npm

npm consists of:

Unit 4: Node.js basic concepts

Node Modules

In the Node.js module system, each file is treated as a separate module.

Non-blocking I/O

Overview of Blocking vs Non-Blocking

Load Testing

Consider case where each request to a web server takes 50ms to complete and 45ms of that 50ms is database I/O that can be done asynchronously. Choosing non-blocking asynchronous operations frees up that 45ms per request to handle other requests. This is a significant difference in capacity just by choosing to use non-blocking methods instead of blocking methods.

Unit 5: The event loop

A complete guide to the Node.js event loop

Unit 8: Node dependency management

  1. Semantic version (semver)

    • npm semver calculator: https://semver.npmjs.com/
    • caret (aka hat) symbol, ^ : include everything that does not increment the first non-zero portion of semver.
      1
      "^2.1.9": >= 2.1.9 and < 3.0.0 
    • tilde symbol, ~ : include everything greater than a particular version in the same minor range.
      1
      "~2.1.9": >= 2.1.9 and < 2.2.0
  2. Visualization of npm dependencies: http://npm.anvaka.com/

Unit 9: Unit testing and linting with Node.js

There are two aspects to code quality that you can automate.

  • Testing
    • A test framework [Mocha.js]
    • An assertion library (if the framework doesn’t come with one) [Chai.js]
    • A test doubles library (again, if the framework doesn’t provide one) [Sinon.js]
    • Code coverage utility [Istanbul]
  • Linting
    • A linter with parser [ESlint]
    • A configuration to apply rules to your code

How to Test NodeJS Apps using Mocha, Chai and SinonJS

Unit 10: Application logging with Winston and Log4js

Application logging is a reality that we as developers have to deal with, and it isn’t going anywhere. When our applications run, things happen. Some of those things are important. Others are not.

Logs tell us what happened and are useful when supporting our applications. console.log() is fine for prototypes, but for production quality applications, you need production quality logging.

You can write this code yourself, but the logging problem has been solved.

Two popular third party logging packages for Node applications

Logging Example on GitHub: link

Unit 11: ExpressJS and Pug

  • ExpressJS: for a web framework, which includes routing.
  • Pug: for the user interface.

ExpressJS and Pug Example on GitHub: link

Unit 12: MongoDB

MongoDB is one of the most popular choices for storing data used with Node applications.