A hands-on exploration of vanilla Node.js fundamentals, covering core built-in modules, event-driven architecture, and building a dynamic HTTP web server from scratch without external framework abstractions (like Express).
- Custom Static File Server: An HTTP web server built entirely with the native
http,path, andfsmodules that serves HTML, CSS, JavaScript, and images dynamically. - Robust Content-Type Handling: Automatic inspection of file extensions to map and append correct MIME content types to server responses.
- Custom Error Views: Graceful handling of server exceptions, including a dedicated
404 Not Foundfallback routing system and500 Server Errordiagnostics. - Event-Driven Logging System: A custom message logger class that extends the native
EventEmitterand utilizesuuidto dispatch tracking IDs alongside log events. - Core Module Experiments: In-depth terminal-driven walkthroughs of Node's integrated subsystems:
fs,path,os,url, andevents.
├── reference/ # Core Module Sandbox Scripts
│ ├── path_demo.js # Path parsing and normalization
│ ├── fs_demo.js # File system CRUD actions (async)
│ ├── os_demo.js # System architecture & hardware metadata
│ ├── url_demo.js # URL string parsing & parameter appending
│ ├── http_demo.js # Barebones HTTP instantiation
│ └── event_demo.js # Native event hook-ins
├── public/ # Front-End Static Web Assets
│ ├── css/
│ │ └── style.css # Global views styling
│ ├── index.html # Landing Page view
│ ├── about.html # About Page view
│ └── 404.html # Error page fallback view
├── index.js # Main server application entry point
├── logger.js # Custom UUID-integrated event logger
├── package.json # Project script workflows & dependencies
└── README.md # Project documentation
🛠️ Installation & Setup
Ensure you have Node.js installed on your machine.
Clone the repository and navigate into the root directory:
Bash
git clone [https://github.com/jessebaugh/nodeCrashCourse.git](https://github.com/jessebaugh/nodeCrashCourse.git)
cd nodeCrashCourse
Install local project dependencies:
This will install runtime packages (like uuid) and development tools (like nodemon).
Bash
npm install
⚙️ Running the Application
The workflow environment is controlled via scripts defined inside package.json:
Development Environment (With Hot-Reloading)
To launch the server using nodemon (which automatically watches for file changes and restarts the runtime), run:
Bash
npm run dev
Production Environment
To start the application normally without continuous reload monitoring:
Bash
npm start
Once running, open your web browser and navigate to http://localhost:5001 to interact with the deployed pages.