Node.js Developer interview question · Most asked
What makes a well-designed REST API in Node.js?
Summary
Resource-oriented URLs, correct HTTP methods and status codes, consistent JSON shapes and error format, pagination/filtering, validation, versioning, idempotency for retries, authentication/authorization, rate limiting and OpenAPI documentation.
Longer Answer
Return 201 + Location for creates, 204 for deletes, 409 for conflicts and 422 for validation errors. Use cursor pagination for large collections and ETags for caching/concurrency.
Key Points
- Resources + correct verbs/status codes
- Consistent errors (RFC 9457)
- Pagination, filtering, versioning
- OpenAPI docs
More most-asked Node.js Developer questions
- Why is CPU-bound work a problem in Node.js and how do you handle it?
- What are streams in Node.js and what is backpressure?
- What is the difference between `process.nextTick`, Promise microtasks, `setImmediate` and `setTimeout(fn, 0)`?
- Explain the phases of the Node.js event loop.
- What is Node.js and why is it well suited to I/O-heavy servers?
- 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.
- What are the differences between CommonJS and ES modules in Node.js?