Backend with Node and Express Course — GameCode
Build real backends with Node.js and Express: create REST APIs with full CRUD, connect SQL and NoSQL databases, secure your routes with authentication and JWT, write tests, add real-time features with WebSockets, and deploy your app to production. The next step after mastering Node.
The Threshold of the Loom
Meet the HTTP Client
Your First Express Server
The req and res objects
Multiple GET Routes
Route params
Query strings
res.json, res.send and res.status
HTTP Status Codes
Reading the body of a POST
GET and POST on the same route
Mini-API: combining everything
The First Threads
The 5 HTTP Methods
res.redirect and res.sendStatus
Route Order
Multiple route params
Optional Parameters and Wildcards
app.all and the 405 Method Not Allowed error
Sending Response Headers
Chaining handlers in a route
404 Handler for Not Found Routes
In-memory resource mini-router
The Intermediate Knots
What is a middleware?
express.json() and express.urlencoded()
Your first custom middleware
The Order of Middleware
Middleware with app.use vs Per-Route
Third-party Middleware: morgan
CORS with the cors package
Middleware that Cuts the Chain (gate 403)
Error Handling Middleware
Combining middleware: a complete mini-app
The Ordered Loom
The Single File Problem
express.Router()
Setting up a router with app.use()
Separate routes into their own file
Controllers: Separating Logic from Routes
Multiple Routers Mounted on the Same App
Middleware at Router Level
Shared Data Module Between Routers
Project Structure: routes/ + controllers/ + data/
Mini-project: Modular API with 2 routers and controllers
The REST Messengers
What is REST? Resources and endpoints
GET collection and GET by id
POST: Create a Resource
PUT vs PATCH: replace vs update
DELETE: remove a resource
Correct REST status codes
Pagination with ?page and ?limit
Filters with ?q=
Sort results with ?sort=
Complete REST API: CRUD + pagination + filters
The Guardians of the Gate
Why Validate Input?
Manual Field Validation
express-validator: first validation rules
Error Messages with validationResult
Sanitization: trim, escape, and normalizeEmail
Validate params and query strings
Consistent Error Responses
AppError Class with statusCode
Error Middleware and Async Handlers
API with validation and end-to-end errors
The Vaults of Data
Why a Database?
Your First SQLite DB
INSERT: Save Data
SELECT: reading data
Connect the DB to an endpoint
CRUD with DB: POST inserts and GET reads
UPDATE and DELETE in the DB
Queries with WHERE and Safe Placeholders
Two Tables and a Simple JOIN
A Complete API Backed by DB
The Guardians of the Threshold
Authentication vs Authorization
Hashing passwords with bcrypt
Verify Password with bcrypt
What is a JWT?
Verify a JWT
Authentication Middleware
Register: create user with hashed password
Login that returns a token
Protected Routes
Roles and Permissions
The Walls of Webcraftia
Disable X-Powered-By
Security Headers with Helmet
Configure Helmet Directives
Origin Control with CORS
Limit the Body Size
Rate limiting with express-rate-limit
Sanitize input to prevent XSS
Protect routes with an API key
Hide Error Details in Production
Hardened Fortress: All Defenses Together
The Mirror of Tests
What is an automated test
Arrange-Act-Assert: anatomy of a test
Test HTTP Status Codes and JSON Shape
Testing routes with parameters
Testing Pure Functions (unit testing)
beforeEach and clean state between tests
Test the Error Path
Mocks and stubs: dependency injection
Branch Coverage and Edge Cases
Integrator Suite: Complete CRUD Flow
The Threads of Real Time
WebSocket vs HTTP — simple echo
Welcome Message on Connection
Message Router by Type
Broadcast to all clients
Real-time connection counter
Chat with Username
Cleanup and Notification on Disconnect
HTTP and WebSocket on the Same Server
Validate malformed messages without crashing
Capstone — Live Room
The Weaver's Crossing
Environment Variables and Configuration
Request logging with morgan
Centralized 404 Handler
Error Handling Middleware
asyncHandler Wrapper for async Routes
Consistent Error Response Format
Health and Readiness Endpoints
Request ID for Log Correlation
Controlled Server Shutdown
Production-Ready App (capstone)