Node.js Interview Questions for Freshers

Published August 18, 2026 · 6 min read

Node.js interviews for freshers center on one idea: how Node handles many operations at once despite running JavaScript on a single thread. Once you can explain that clearly, the rest — middleware, async patterns, npm — falls into place as supporting detail.

Core Node.js Concepts

What makes Node.js non-blocking?

Node runs JavaScript on a single thread, but I/O operations (reading a file, querying a database, making a network request) are handed off to the system and don't block that thread while they complete. When an operation finishes, its callback gets queued and runs on the event loop once the current work is done. This is why Node can handle thousands of concurrent connections efficiently for I/O-heavy workloads, even without spinning up a thread per request the way some other runtimes do.

CommonJS vs. ES Modules

CommonJS is Node's original module system — require() to import, module.exports to export, resolved synchronously. ES Modules are the standard JavaScript module system — import/export, resolved asynchronously. Modern Node supports both, but knowing which one a given project uses (check package.json's "type" field) matters in practice.

Common Node.js Interview Questions

Callbacks vs. Promises vs. async/await. A callback is a function passed in to run once an async operation finishes — simple, but nested callbacks get hard to read ("callback hell"). A Promise represents a value that will eventually resolve or reject, and can be chained with .then(). async/await is syntax built on top of Promises that lets asynchronous code read like synchronous code, which is why it's the default choice in most modern Node code.

What is middleware (in Express)? A function that sits between the incoming request and the final route handler, with access to the request, response, and a next() function to pass control forward. It's used for things like logging, authentication checks, and parsing the request body — each middleware can inspect or modify the request before passing it along.

npm, package.json, and package-lock.json. npm is Node's package manager. package.json lists your project's dependencies and metadata. package-lock.json locks the exact resolved version of every dependency (including nested ones), so an install on a different machine produces the identical dependency tree — without it, a caret range like ^1.2.0 in package.json could resolve to a different minor version later.

A Question You Should Expect

"Walk me through what happens when a request hits an Express route with two middleware functions before it." A solid answer: the request enters the first middleware, which does its work and calls next() to pass control to the second middleware, which does the same, and only then does the actual route handler run and send a response. If any middleware doesn't call next(), the request hangs.

How to Prepare

Build a small REST API with a couple of routes and one piece of custom middleware — it's the fastest way to make these concepts concrete instead of abstract. If you're prepping for a full-stack role, pair this with our JavaScript & React interview questions guide, and see our AWS guide if deployment questions come up too. Practice explaining the event loop and async patterns out loud with a live-scored AI Mock Interview, or drill core concepts daily with Flash Practice.

Frequently Asked Questions

What makes Node.js non-blocking despite being single-threaded? Node runs JavaScript on one thread but hands I/O operations off to the system instead of blocking that thread — when an operation finishes, its callback is queued and runs on the event loop once current work is done.

What's the difference between callbacks, Promises, and async/await? A callback runs once an async operation finishes but can nest into "callback hell." A Promise represents a future value and can be chained with .then(). async/await is syntax built on Promises that lets async code read like synchronous code.

What is middleware in Express? A function that sits between an incoming request and the final route handler, with access to the request, response, and a next() function to pass control forward — used for logging, auth checks, and parsing request bodies.

Why does package-lock.json matter? It locks the exact resolved version of every dependency, including nested ones, so an install on a different machine produces an identical dependency tree instead of a caret range like ^1.2.0 possibly resolving differently later.