HomebaseWorks

Node.js interview questions

Questions often used to check whether a candidate understands how Node handles concurrency and how an Express service is put together.

EWritten by the HomebaseWorks editorial team · reviewed 26 Oct 2026
1
How can Node handle many requests on a single thread?

Most server work is waiting on databases, files or other services, and Node hands that waiting to the operating system and its thread pool. The JavaScript thread only runs short callbacks when results arrive. That is why one blocking loop hurts everyone, and why CPU-heavy work belongs in worker threads or a separate service.

2
What is the difference between process.nextTick, promises and setTimeout?

nextTick callbacks run first, right after the current operation, then promise callbacks, both as microtasks. setTimeout callbacks run in the timers phase of the next loop iteration. So for the same tick, the order is nextTick, then promise, then timeout.

3
What is middleware in Express?

Middleware is a function that sits between the incoming request and the final route handler, with access to req, res and next. I use it for parsing bodies, logging, authentication and error handling. Each one must either end the response or call next, and they run in the order registered.

Advertisement
4
How do you handle errors in an async Express route?

I wrap the awaited work in try/catch and call next(err), or use a small asyncHandler wrapper, so the error reaches one central error middleware. That handler logs the details and sends a safe message with the right status code. On newer Express versions rejected promises are forwarded automatically, but I still keep the central handler.

5
What is the difference between dependencies and devDependencies?

dependencies are packages the app needs to run, such as Express or a database driver. devDependencies are only for development, like test runners, linters and build tools. A production install can skip devDependencies, which keeps the deployed image smaller.

6
How do you manage configuration and secrets?

I read configuration from environment variables, validate them once at startup and fail early if a required one is missing. Locally I use a .env file that is in .gitignore, and in production the values come from the hosting platform's secret settings. Nothing secret goes into the repository or the logs.

Practise out loud. Say each answer once as written, then again in your own words with your own number or story.

Have a number ready. "My Node.js score is at benchmark on a timed test" is a stronger answer than "I am good at it". Take the test and quote the result.

Advertisement
Continue with Node.js4 lessons · 1 interview set · 1 test · 1 certificate
Not tested

More in Web and app