Node.js — Runtime Internals, Express, APIs and SQL Server
Architecture
V8 (JS engine) + libuv (event loop, thread pool of 4, async I/O) · your JS on one main thread · I/O non-blocking · CPU work → worker threads.
Event loop order
sync code → process.nextTick → promise microtasks → timers → pending → poll (I/O) → check (setImmediate) → close callbacks.
Express essentials
express.json() · routers per feature · middleware order matters · (err, req, res, next) error handler · Express 5 async errors · helmet, cors, rate limit, validation.
SQL Server from Node
mssql ConnectionPool once · .input(name, type, value) parameters · .execute(proc) · sql.Transaction · encrypt: true (Azure) · Prisma provider = "sqlserver" · secrets in env vars.
Production
LTS (even) versions · npm ci · NODE_ENV=production · PM2/cluster or containers · graceful SIGTERM shutdown · pino logging · monitor event-loop lag and heap.