Loading...
Loading...
Browse 8 real-world technical and behavioral interview questions about Nodejs. Review scenarios, edge cases, and architectural best practices.
An unhandled promise rejection in Node.js means a promise failed before any code observed the error. Treat it as a bug, await or return the promise chain, and make the process-level handler a last-resort alarm.
Node.js event loop blocking happens when synchronous JavaScript, JSON work, crypto, regex or CPU-heavy code occupies the shared thread. The signal is every endpoint slowing together while event loop delay rises.
ERR_HTTP_HEADERS_SENT means an Express route tried to set status or headers after the response had already been sent. The usual cause is two response paths: missing return after res.send, async callbacks racing, or an error handler trying to respond after headers are committed.
An Express error handler is skipped when it is not registered after routes, lacks the four-argument signature, or an async error never reaches next(). Express 4 needs explicit next(err) for rejected promises; Express 5 forwards them automatically.
Substitute at the network layer or behind your own client interface, not at the HTTP library's function. Stubbing the library couples the test to how you make the call rather than to what you send, so the test keeps passing through refactors that change the request and breaks on refactors that change nothing.
The failing test is a victim, not the cause: something earlier mutated state it shares, usually a module evaluated once, a global that was patched and not restored, or rows left in a database. Bisect the ordering to find the pair, then remove the sharing.
Node.js stream backpressure prevents a fast producer from filling memory while a slow consumer catches up. The core signal is write() returning false and the producer waiting for drain before sending more.
Not one package but its whole transitive closure, install-time scripts from every node in it, a build that now depends on the registry being reachable, and the possibility of two resolved copies of the same library whose instances fail each other's identity checks.