Skip to content

orassayag/nodejs-learning-v2

Repository files navigation

Node.js Learning V2

A comprehensive Node.js learning repository demonstrating fundamental to advanced concepts from Mosh Hamedani's "Node.js: The Complete Guide to Build RESTful APIs (2018)" course.

Built in November 2018. This repository contains 4 progressive learning modules covering Node.js basics, core modules, debugging, web scraping, and Express.js fundamentals.

Features

  • 📚 4 Progressive learning modules from basics to advanced
  • 🧪 Testing examples with Jest
  • 🔍 Debugging configurations for VSCode
  • 🌐 Web scraping examples with Nightmare.js and Crawler
  • 🗂️ File system operations and directory traversal
  • 🚀 Express.js server setup examples
  • 💡 JavaScript fundamentals (scope, closures, context)

Getting Started

Prerequisites

  • Node.js (v8 or higher recommended for course compatibility)
  • npm (comes with Node.js)
  • VSCode (recommended for debugging features)

Installation

  1. Clone the repository:
git clone https://github.com/orassayag/nodejs-learning-v2.git
cd nodejs-learning-v2
  1. Navigate to a specific module and install dependencies:
cd 02/first-app
npm install
  1. Run the module:
npm start

Learning Modules

Module 01: Hello World

Path: 01/first-app/

Basic Node.js execution with a simple greeting function.

cd 01/first-app
node app.js

Learning objectives:

  • Running JavaScript with Node.js
  • Function definitions
  • Template literals

Module 02: Node.js Core Modules

Path: 02/first-app/

Explores Node.js built-in modules including path, file system, and custom modules.

cd 02/first-app
npm install
npm start

Learning objectives:

  • Creating and importing custom modules
  • Working with the path module
  • File system operations (fs)
  • Directory traversal algorithms
  • Unit testing with Jest

Module 03: JavaScript Fundamentals

Path: 03/firstApp/

JavaScript basics focusing on scope and iteration.

cd 03/firstApp
node index.js

Learning objectives:

  • Block scope with let
  • Loop constructs
  • Variable lifecycle

Module 04: Advanced Topics

Path: 04/debug-demo/

Advanced examples including web scraping, debugging, and Express.js.

cd 04/debug-demo
npm install
node index.js

Learning objectives:

  • Web scraping with Nightmare.js (headless browser)
  • Crawling with the Crawler library
  • Debugging with breakpoints
  • Express.js server setup
  • Arrow functions vs regular functions
  • Context (this) binding
  • Closures and IIFE patterns
  • Recursive file system traversal

Project Structure

graph TD
    A[nodejs-learning-v2] --> B[01/first-app]
    A --> C[02/first-app]
    A --> D[03/firstApp]
    A --> E[04/debug-demo]
    
    B --> B1[app.js - Hello World]
    
    C --> C1[app.js - Core modules]
    C --> C2[logger.js - Custom module]
    C --> C3[package.json - Jest testing]
    
    D --> D1[index.js - Scope examples]
    
    E --> E1[index.js - Scraping & debugging]
    E --> E2[Dependencies: nightmare, crawler, express]
Loading

Module Flow Diagram

flowchart LR
    A[Start Learning] --> B[Module 01: Basics]
    B --> C[Module 02: Core Modules]
    C --> D[Module 03: JavaScript Fundamentals]
    D --> E[Module 04: Advanced Topics]
    E --> F[Complete]
    
    style A fill:#e1f5ff
    style F fill:#d4edda
Loading

Available Scripts

Each module may have different scripts. Common ones:

Module 02

npm start    # Run the application
npm test     # Run Jest tests

Modules 01, 03, 04

node app.js    # or node index.js

Debugging

VSCode

Module 02 includes VSCode launch configurations:

  1. Open the module in VSCode
  2. Set breakpoints in code
  3. Press F5 to start debugging

Node.js Inspector

node inspect index.js

Dependencies Overview

Module 02

  • jest (^22.2.2) - Testing framework

Module 04

  • express (^4.16.4) - Web application framework
  • nightmare (^3.0.1) - Headless browser automation
  • crawler (^1.2.0) - Web crawling and scraping
  • after-load (^1.0.4) - HTML page loading utility

Key Concepts Covered

Node.js Core

  • Module system (require, module.exports)
  • Built-in modules (path, fs)
  • Asynchronous patterns
  • Error handling

JavaScript Advanced

  • Arrow functions vs regular functions
  • Context (this) binding
  • Closures and scope
  • IIFE (Immediately Invoked Function Expressions)
  • Block scope vs function scope

Web Development

  • Express.js basics
  • Web scraping ethics and techniques
  • HTTP requests
  • DOM manipulation with headless browsers

Development Practices

  • Unit testing with Jest
  • Debugging techniques
  • Code organization
  • Module patterns

Code Examples

Custom Module (Module 02)

// logger.js
module.exports = function(message) {
    console.log(message);
};

// app.js
const log = require('./logger');
log('Hello World');

Web Scraping (Module 04)

const Nightmare = require('nightmare');
const nightmare = Nightmare();

nightmare
    .goto('https://example.com')
    .evaluate(() => document.querySelector('h1').innerText)
    .then(console.log);

Contributing

Contributions to this project are released to the public under the project's open source license.

Everyone is welcome to contribute. Contributing doesn't just mean submitting pull requests—there are many different ways to get involved, including answering questions and reporting issues.

Please feel free to contact me with any question, comment, pull-request, issue, or any other thing you have in mind.

Author

License

This application has an MIT license - see the LICENSE file for details.

Acknowledgments

  • Mosh Hamedani - Course instructor
  • Course: "Node.js: The Complete Guide to Build RESTful APIs (2018)"
  • Built as part of a structured learning journey in November 2018

About

A comprehensive Node.js learning repository demonstrating fundamental to advanced concepts from Mosh Hamedani's "Node.js: The Complete Guide to Build RESTful APIs (2018)" course. Built in November 2018. This repository contains 4 progressive learning modules covering Node.js basics, core modules, debugging, web scraping, and Express.js fundamental

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors