Node.js Developer interview question · Most asked
What is Node.js and why is it well suited to I/O-heavy servers?
Summary
Node.js is a JavaScript runtime built on Chrome's V8 engine and libuv. It runs your JavaScript on a single main thread with an event loop and non-blocking I/O, so one process can handle many concurrent connections that mostly wait on network, disk or databases.
Longer Answer
Instead of a thread per request, Node registers I/O operations with the OS (epoll/kqueue/IOCP via libuv) and runs callbacks when results are ready. That makes it efficient for APIs, real-time apps (WebSockets), proxies and streaming. CPU-heavy work blocks the event loop, so it needs worker threads, child processes or separate services.
Key Points
- V8 + libuv runtime
- Single-threaded event loop for JS
- Non-blocking I/O handles high concurrency
- CPU-bound work must be offloaded
Explanation
What interviewers look for
Clear explanation of why single-threaded doesn't mean slow for I/O, and the CPU-bound caveat.
Follow-up questions
- What does libuv's thread pool do?
More most-asked Node.js Developer questions
- What are streams in Node.js and what is backpressure?
- What are the differences between CommonJS and ES modules in Node.js?
- Explain the phases of the Node.js event loop.
- What is the difference between `process.nextTick`, Promise microtasks, `setImmediate` and `setTimeout(fn, 0)`?
- How has asynchronous code evolved in Node.js: callbacks, Promises and async/await?
- Walk through how an Express app handles a request, including errors from async handlers.
- Why is CPU-bound work a problem in Node.js and how do you handle it?
- How does middleware work in Express?