A comprehensive Node.js learning repository built while following Mosh Hamedani's "Node.js: The Complete Guide to Build RESTful APIs (2018)" course.
Built in November 2018, the project is organized into four progressive modules covering Node.js fundamentals, core modules, file system operations, debugging, testing with Jest, and Express.js basics. It also includes web scraping examples using Nightmare.js and Crawler, while exploring JavaScript concepts such as closures, scope, context binding, IIFEs, and ES6 features, providing a practical foundation for backend development.
- 📚 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)
- Module-based Learning: 4 self-contained modules progressing from basics to advanced
- Hands-on Examples: Practical code examples for every concept
- Testing Integration: Jest testing examples in core modules
- Debugging Tools: VSCode debugging configurations
- Web Scraping Examples: Nightmare.js and Crawler implementations
- JavaScript Deep Dive: Scope, closures, context, arrow functions, and more
- Clean Code Organization: Each module is self-contained with clear separation
- Testing Coverage: Jest testing framework integration
- Debugging Support: Built-in debugging configurations for VSCode
- Module System Best Practices: Proper use of Node.js require/module.exports
- Error Handling Examples: Asynchronous patterns and error management
- Progressive Learning Path: Modules build on each other incrementally
- VSCode Integration: Debug configurations and settings
- Self-contained Modules: Each module can be explored independently
- Comprehensive Examples: Real-world use cases like web scraping and Express servers
- Clear Documentation: Learning objectives for each module
- Node.js (v8 or higher recommended for course compatibility)
- npm (comes with Node.js)
- VSCode (recommended for debugging features)
- Clone the repository:
git clone https://github.com/orassayag/nodejs-learning-v2.git
cd nodejs-learning-v2- Navigate to a specific module and install dependencies:
cd 02/first-app
npm install- Run the module:
npm startEach module is self-contained in directories 01-04:
# Module 01 - Hello World
cd 01/first-app
node app.js
# Module 02 - Core Modules
cd 02/first-app
npm install
npm start
# Module 03 - JavaScript Fundamentals
cd 03/firstApp
node index.js
# Module 04 - Advanced Topics
cd 04/debug-demo
npm install
node index.js- No environment configuration required
- Each module is self-contained
- Dependencies are installed per-module
VSCode configurations are provided in .vscode/settings.json and .vscode/launch.json for debugging.
This project follows these learning-focused architecture principles:
- Progressive Complexity: Modules start simple and increase in complexity
- Self-containment: Each module can be explored independently
- Practical Examples: Every concept has a working code example
- Clear Separation: Concerns are separated by module purpose
- Testability: Examples include testing where appropriate
nodejs-learning-v2/
├── 01/first-app/ # Module 01: Hello World
│ └── app.js
├── 02/first-app/ # Module 02: Core Modules + Testing
│ ├── app.js
│ ├── logger.js
│ ├── package.json
│ └── .vscode/
│ ├── launch.json
│ └── settings.json
├── 03/firstApp/ # Module 03: JavaScript Fundamentals
│ └── index.js
├── 04/debug-demo/ # Module 04: Advanced Topics
│ ├── index.js
│ └── package.json
├── .github/
│ └── rulesets/
├── .vscode/
│ └── settings.json
├── .gitignore
├── .prettierrc
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── INSTRUCTIONS.md
├── LICENSE
├── README.md
└── SECURITY.md
- Module Pattern: Using Node.js module system (require/module.exports)
- Factory Pattern: Examples in custom modules
- Singleton Pattern: Logger module example
- Closure Patterns: Demonstrated in JavaScript fundamentals
- IIFE (Immediately Invoked Function Expressions): For scope control
- Follow Module Order: Start with Module 01 and progress through to Module 04
- Run All Examples: Execute each code example to see it in action
- Experiment: Modify code to see how changes affect behavior
- Use Debugger: Step through code with VSCode debugger
- Write Tests: Practice writing additional tests with Jest
- Keep Modules Self-contained: Each module has its own dependencies
- Use Clear Naming: Files and functions have descriptive names
- Comment Where Necessary: Complex examples include explanatory comments
- Test Your Changes: Use Jest to verify your modifications
For questions, issues, or contributions:
- GitHub Issues: https://github.com/orassayag/nodejs-learning-v2/issues
- Email: orassayag@gmail.com
Path: 01/first-app/
Basic Node.js execution with a simple greeting function.
cd 01/first-app
node app.jsLearning objectives:
- Running JavaScript with Node.js
- Function definitions
- Template literals
Path: 02/first-app/
Explores Node.js built-in modules including path, file system, and custom modules.
cd 02/first-app
npm install
npm startLearning objectives:
- Creating and importing custom modules
- Working with the
pathmodule - File system operations (
fs) - Directory traversal algorithms
- Unit testing with Jest
Path: 03/firstApp/
JavaScript basics focusing on scope and iteration.
cd 03/firstApp
node index.jsLearning objectives:
- Block scope with
let - Loop constructs
- Variable lifecycle
Path: 04/debug-demo/
Advanced examples including web scraping, debugging, and Express.js.
cd 04/debug-demo
npm install
node index.jsLearning 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
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]
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
Each module may have different scripts. Common ones:
npm start # Run the application
npm test # Run Jest testsnode app.js # or node index.jsModule 02 includes VSCode launch configurations:
- Open the module in VSCode
- Set breakpoints in code
- Press F5 to start debugging
node inspect index.js- jest (^22.2.2) - Testing framework
- 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
- Module system (
require,module.exports) - Built-in modules (
path,fs) - Asynchronous patterns
- Error handling
- Arrow functions vs regular functions
- Context (
this) binding - Closures and scope
- IIFE (Immediately Invoked Function Expressions)
- Block scope vs function scope
- Express.js basics
- Web scraping ethics and techniques
- HTTP requests
- DOM manipulation with headless browsers
- Unit testing with Jest
- Debugging techniques
- Code organization
- Module patterns
// logger.js
module.exports = function (message) {
console.log(message);
};
// app.js
const log = require('./logger');
log('Hello World');const Nightmare = require('nightmare');
const nightmare = Nightmare();
nightmare
.goto('https://example.com')
.evaluate(() => document.querySelector('h1').innerText)
.then(console.log);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.
- Or Assayag - Initial work - orassayag
- Or Assayag orassayag@gmail.com
- GitHub: https://github.com/orassayag
- StackOverflow: https://stackoverflow.com/users/4442606/or-assayag?tab=profile
- LinkedIn: https://linkedin.com/in/orassayag
This application has an MIT license - see the LICENSE file for details.
- Built for educational and research purposes
- Respects robots.txt and implements rate limiting
- Uses user-agent rotation to avoid detection
- Implements polite crawling practices