Core Node.js Modules
5 min read
Module Overview
What You’ll Learn
- Read and write files with Node’s
fsmodule - Work with file paths, processes, and events without a framework
- Build a basic HTTP server using nothing but Node’s built-in
httpmodule
💡 Why this module matters: Express is built on top of these exact modules. Using them directly first, before Express hides the details, makes it clear what a framework is actually doing for you, and gives you tools you’ll reach for constantly even in an Express project.
What’s Covered
- fs, reading, writing, and working with files and directories.
- path, building file paths correctly across operating systems.
- os, information about the machine a program is running on.
- process, the currently running Node program itself, including arguments and exit codes.
- crypto, hashing and generating secure random values.
- events, Node’s event emitter pattern, the foundation the rest of Node is built on.
- http, building a raw HTTP server, no framework involved.
- url, parsing and working with URLs.
- stream, handling data that arrives in pieces rather than all at once.
- readline, reading input line by line, useful for simple command-line tools.
Hands-On
By the end of this module, you’ll have built a working HTTP server using only Node’s built-in http module, and used several other core modules to read files, hash values, and handle events directly.
Next module: Express.js, and everything these core modules were preparing you for.