Node.js

Node.js interview questions with practical answers

Node.js interview preparation should connect JavaScript behaviour to real API problems. Start with the event loop and error handling, then practise explaining how you would investigate a slow endpoint or repeated request. The scenarios below are original exercises, not questions attributed to a particular employer.

1. What does it mean to block the event loop?

When a JavaScript callback performs lengthy synchronous work, the event loop cannot move on to other callbacks until that work finishes. Even a server handling asynchronous I/O can become unresponsive if one callback does too much processing.

Practice example: an endpoint reads a large input and then performs an expensive calculation. Identify which work waits for I/O and which consumes CPU time. Explain how you would measure the problem before deciding whether to partition or offload the computation. [1]

2. Does async automatically move code to another thread?

No. Marking a function async does not automatically move its JavaScript calculations off the event loop. A long synchronous loop inside that function still occupies the thread running it. Distinguish waiting for asynchronous work from performing CPU-heavy work.

Follow-up to practise: describe why wrapping a calculation in a Promise is not, by itself, a solution to CPU blocking. Explain what you would measure under concurrent requests. [1]

3. How do asynchronous errors reach Express error handling?

The answer depends on the Express version and how the asynchronous operation is connected to the handler. Express 5 forwards rejection from a returned Promise to error handling. Callback-based asynchronous work still needs errors passed into the appropriate error-handling flow.

For an interview, state the version you are discussing. Explain how expected client errors and unexpected failures should be reported, and avoid returning internal stack traces as a public API response. [2]

4. How would you investigate a slow API endpoint?

Practice scenario: a dashboard endpoint becomes slow during busy periods. Start with evidence from requests that are actually slow. Separate time spent waiting for a database, waiting for another service, processing data, and transferring the response.

Ask what changed and whether all requests are affected. Form one hypothesis, collect a useful measurement, and test a targeted improvement. Explain how you would compare latency and failure rates under similar traffic. “Add caching” is a possible option to evaluate, not an investigation by itself.

5. What would you ask about a repeated create request?

Practice scenario: a user taps “Create booking” twice because the first response is delayed. Before proposing code, clarify whether the backend received both requests, whether either operation completed, and what the product should consider a duplicate.

Outline the questions your design must answer: how to identify the same intended operation, how concurrent attempts are handled, how a retry receives a meaningful response, and which failure cases to test. Explain where you would verify the guarantees of the database and any external services involved.

Prepare one API story you can explain end to end

Choose a real endpoint you worked on. Describe its input, validation, permissions, business operation and response. Include one failure path and explain how you diagnosed it. If you improved performance, describe the measurement rather than using an unsupported percentage.

For practice, write a small endpoint with successful, invalid-input and dependency-failure cases. Make a short checklist of expected behaviour before running it. Then explain the implementation without reading the code. This helps you notice gaps between writing a solution and communicating it.

Use listening to rehearse the explanation

InterviewFM lets you hear interviewer–candidate conversations and prepare around your role and experience. Pause before an answer and explain your approach aloud. Follow the listening session with code, a request test, or a small debugging exercise so the explanation is grounded in something you have checked.

Frequently asked questions

Should I prepare JavaScript for a Node.js interview?

Yes. Practise asynchronous control flow, error propagation and ordinary JavaScript reasoning alongside API design. Build small examples that let you explain the execution rather than memorising output.

What should a senior Node.js candidate focus on?

Prepare examples involving reliability, performance investigation, service boundaries and operational trade-offs. Explain the constraints, your contribution and the evidence behind the result.

Technical references

  1. Do Not Block the Event Loop
  2. Express Error Handling

Examples and practice scenarios are original exercises.

Listen. Learn. Practise your answer.

Explore interview conversations in InterviewFM and build a preparation routine around your role.