Web Development · Revision notes
Backend Architecture with Node.js & Express
Node.js runs JavaScript on the server using V8 and the libuv event loop for non-blocking I/O. Core modules and streams handle files and network data efficiently, Express adds routing and middleware, REST principles shape clean APIs, and JWT with proper hashing secures them.
Quick revision
- Node = V8 + libuv; single JS thread with event loop phases; thread pool for fs/crypto/dns
- avoid blocking the loop; worker_threads / cluster / queues for CPU work
- streams + pipeline = constant memory, backpressure, error handling
- build paths with path.join and block ../ traversal
- middleware (req,res,next) runs in order; parsers first, error handler (4 args) last
- GET/POST/PUT/PATCH/DELETE semantics; idempotent and safe methods
- 200/201/204/400/401/403/404/409/422/429/500
- plural nouns, pagination, consistent error JSON, versioning