This tutorial takes you from running your first Node.js script to building a complete REST API. Each module builds on the previous one, showing you how Node.js web development works from the ground up.
Unlike PHP (which runs inside a web server), Node.js applications create their own HTTP servers. You'll learn what that means and how to leverage it.
Understand Node.js fundamentals: running scripts, ES6+ features, and the event loop.
Build a web server from scratch using Node's built-in http module.
http.createServer()The Express framework: routing, middleware, and static files.
Process GET and POST data, parse request bodies.
req.query and req.bodyBuild a simple RESTful API with CRUD operations.
node --version
If not installed, download from nodejs.org
| PHP | Node.js (Express) |
|---|---|
$_GET['name'] |
req.query.name |
$_POST['email'] |
req.body.email |
$_SERVER['REQUEST_METHOD'] |
req.method |
header('Content-Type: ...') |
res.set('Content-Type', '...') |
echo json_encode($data) |
res.json(data) |