
35 Express.js Interview Questions and Answers to Know
Screening a Node.js developer you want to hire without solid express js interview questions ready is a fast way to make a bad hire. Express is the backbone of most Node backends, and a candidate who talks fluently about middleware or routing on their resume can still stumble the moment you ask them to explain error handling or REST design in practice. If you're a technical recruiter or hiring manager who needs to separate real backend skill from buzzword familiarity, you need questions that actually test depth.
This article gives you 35 express js interview questions and answers, covering everything from core concepts like middleware chains and routing to harder topics like performance tuning, security, and scaling with clusters. Each answer is written so you can judge a candidate's response even if you're not writing Express code yourself day to day.
We've organized the list by difficulty, so you can build a screening flow that moves from junior-level basics to senior architecture questions. Pair this with structured technical screening on Olibr, where an AI-powered interview screen helps you validate answers at scale before a live round.
1. Express.js and Node.js fundamentals
Every strong Express developer can explain how Express.js compares to Node.js in web development without conflating the two. Fundamentals questions separate candidates who've built real APIs from those who copied boilerplate from a tutorial, and they're the right place to start any set of express js interview questions. Begin here before moving to routing or middleware, because a shaky grasp of the event loop or the request lifecycle usually predicts trouble later in the conversation.
A candidate who can't explain why Express needs Node's event loop probably can't debug a stuck server at 2 a.m.
Sample questions and answers
Ask these five questions to gauge baseline competence:
- What is Express.js, and why use it over raw Node.js? Express is a minimal, unopinionated web framework built on Node's HTTP module, and one of several Node.js frameworks for building apps. It adds routing, middleware, and response helpers so developers don't rewrite boilerplate for every project. A good answer mentions that Express doesn't replace Node, it wraps it.
- How does the Node.js event loop affect Express request handling? Express is single-threaded and non-blocking by default. Every request runs through the same event loop, so a synchronous, CPU-heavy operation in one route handler blocks every other request until it finishes. Strong candidates mention offloading heavy work to worker threads or a queue.
- What's the difference between
app.use()andapp.get()?app.use()mounts middleware or a router for all HTTP methods and, unless scoped, all paths.app.get()binds a handler specifically to GET requests on a given route. - Explain the request-response cycle in Express. A request enters, passes through matched middleware in registration order, hits a route handler, and either sends a response or calls
next()to pass control along. If nothing sends a response, the request hangs. - Why does splitting routes into separate router files matter for a growing codebase? It keeps controllers, routes, and config isolated, which makes a codebase maintainable once it passes a handful of endpoints and multiple contributors.
What interviewers are really testing
Underneath these questions, you're testing whether a candidate understands asynchronous execution, not just Express syntax. Someone who can recite the definition of middleware but can't explain why a blocking loop in a handler would freeze an entire API doesn't have production-ready knowledge. Watch for candidates who default to "it just works" instead of walking through what happens request by request.
Vague answers here are a red flag during junior-level screening, especially if a candidate can't distinguish Express-specific behavior from general Node.js behavior, which a round of Node.js interview questions and answers will expose quickly. This distinction matters most when you're hiring for a role touching performance-sensitive services, since a developer who conflates the two often writes code that scales poorly under real traffic. For a deeper technical reference on the runtime itself, Node.js's own documentation on the event loop is worth keeping open while you screen.
2. Routing and HTTP methods
Routing is where most candidates either show real REST instincts or reveal that they've only ever followed tutorial patterns. Routing questions test whether someone can design clean, predictable URLs and map them correctly to HTTP verbs, which matters the moment an API grows past a handful of endpoints. Interview questions on express js routing also catch candidates who confuse route parameters with query strings, a mixup that shows up constantly in sloppy production code.
A candidate who can't explain the difference between PUT and PATCH probably hasn't built an API that other teams actually depend on.
Sample questions and answers
Use these to check whether routing knowledge is practical or purely theoretical:
- What's the difference between route parameters and query strings? Route parameters (
/users/:id) identify a specific resource and are part of the URL path. Query strings (/users?role=admin) filter or modify a request and are optional key-value pairs after the?. - Explain the difference between PUT and PATCH. PUT replaces an entire resource; PATCH updates only the fields provided. A candidate who treats them as interchangeable hasn't designed a real REST API.
- How do you handle route ordering and wildcard matching in Express? Express matches routes top to bottom, so a wildcard or generic route defined too early will swallow requests meant for more specific handlers below it.
- What is
express.Router(), and why use it? It creates a modular, mountable route handler, letting teams split routes across files and mount them under a common prefix withapp.use(). - How would you version an API in Express? Common approaches include prefixing routes (
/api/v1/) or mounting separate routers per version, keeping breaking changes isolated.
What interviewers are really testing
Beneath the syntax, you're checking whether a candidate thinks in terms of resource design, not just wiring up endpoints. Candidates who can explain route precedence and versioning strategy tend to write APIs that age well as requirements shift. Weak answers here often correlate with messy, unmaintainable route files down the line, so treat this section as a strong signal for how a hire will structure real projects.
3. Middleware concepts
Middleware is the concept that trips up more candidates than any other topic on this list. Middleware questions reveal whether someone actually understands how Express processes a request, or whether they've just memorized the syntax for app.use(). Since almost every Express app leans on middleware for logging, auth, parsing, and validation, a shaky answer here usually means shaky production code somewhere in their history.

If a candidate can't explain what happens when you forget to call
next(), they've probably shipped a hanging endpoint before.
Sample questions and answers
These five questions separate candidates who understand the middleware chain from those who just use it by habit:
- What is middleware in Express, and what can it access? A middleware function has access to the request, response, and the
next()function. It can inspect or modify the request, end the cycle by sending a response, or pass control forward by callingnext(). - What happens if you forget to call
next()in a middleware function? The request hangs indefinitely, since no other middleware or route handler ever fires and no response is sent. - What's the difference between application-level and router-level middleware? Application-level middleware is bound with
app.use()and can apply globally. Router-level middleware attaches to anexpress.Router()instance and only runs for routes mounted under that router. - How does middleware order affect behavior? Express executes middleware in the exact order it's registered, so placing a body parser after a route handler that needs
req.bodywill break that handler. - Can you write a middleware function that logs request duration? A strong candidate can sketch this without hesitation, referencing
Date.now()at the start and comparing it at response finish or in ares.on('finish')listener.
What interviewers are really testing
Watching how a candidate explains middleware chaining tells you whether they think sequentially about request flow or just bolt on packages without understanding execution order. Candidates who can write a small custom middleware from scratch, rather than only naming popular ones like cors or helmet, demonstrate real hands-on experience. This section is a strong predictor of how cleanly someone will structure cross-cutting concerns like logging, auth checks, and validation across a growing codebase.
4. Request and response handling
Request and response handling questions catch candidates who've never had to deal with anything beyond a simple JSON payload. Request handling questions reveal whether someone understands the full shape of req and res objects, including file uploads, headers, and status codes, rather than just calling res.send() and moving on. A candidate who's only built toy projects often stumbles the moment you ask about content negotiation or streaming a large response.
A candidate who can't explain when to use
res.json()versusres.send()probably hasn't shipped an API that other teams consume.
Sample questions and answers
Use these five questions to check whether a candidate has handled real-world request and response scenarios:
- What's the difference between
res.send(),res.json(), andres.end()?res.send()auto-detects content type and works for strings, objects, or buffers.res.json()explicitly serializes data as JSON and sets the correct header.res.end()closes the response without sending a body, useful for HEAD requests or manual streaming. - How do you access data from a POST request body? With body-parsing middleware like
express.json()orexpress.urlencoded(), then readingreq.body. Without that middleware,req.bodyis undefined. - How would you handle file uploads in Express? Most candidates mention
multer, explaining it parses multipart form data and attaches files toreq.fileorreq.files. - What's the purpose of setting HTTP status codes explicitly? Status codes communicate outcome to clients and downstream systems; a strong answer distinguishes 400 (client error) from 500 (server error) rather than defaulting everything to 200.
- How do you handle streaming large responses, like CSV exports? Piping data through a stream instead of buffering the entire payload in memory, which keeps memory usage flat regardless of response size.
What interviewers are really testing
These questions check whether a candidate treats the request-response cycle as more than a black box between route and database. Someone who understands headers, status codes, and streaming tends to write APIs that integrate cleanly with frontend teams and third-party consumers. Weak answers here often signal a candidate who's only worked on internal tools where sloppy responses never mattered.
5. Error handling and debugging
Error handling is where sloppy Express code gets exposed fastest. Error handling questions show whether a candidate builds APIs that fail gracefully or whether every unhandled exception crashes the process and takes down every other in-flight request. Any solid set of express js interview questions and answers needs this section, because production incidents almost always trace back to error paths nobody tested.
A candidate who can't explain the four-argument error middleware signature has probably never debugged a production crash at 3 a.m.
Sample questions and answers
Use these five questions to test whether error handling knowledge goes past the basics:
- How does Express identify error-handling middleware? By its signature: four arguments,
(err, req, res, next), instead of the usual three. Express skips regular middleware and routes straight to the first matching error handler whennext(err)is called. - What happens to an unhandled error thrown inside an async route handler? In older Express versions, it silently crashes or hangs unless wrapped in try/catch or a helper. Express 5 handles rejected promises automatically, so a candidate should know which version behavior they're describing.
- How would you centralize error handling across a large app? A single error-handling middleware at the end of the middleware stack, with custom error classes carrying status codes and messages, keeps error logic out of individual route handlers.
- What tools would you use to debug a slow or hanging Express route? Strong answers mention Node's built-in inspector,
console.time(), or APM tools, plus checking for blocking synchronous code. - How do you avoid leaking stack traces to clients in production? Conditionally sending detailed errors only in development, and returning generic messages with correct status codes in production.
What interviewers are really testing
Beneath the syntax, these questions test whether a candidate treats failure as a first-class concern, not an afterthought. Candidates who can walk through a real debugging session, not just recite the four-argument signature, demonstrate they've owned production code under pressure. Interviewers who skip this topic often end up hiring developers whose APIs work fine in demos but fall apart the first time a database call times out.
6. Template engines and static file serving
Most modern Express APIs serve JSON to a frontend framework, but plenty of roles still expect candidates to know server-side rendering and static asset delivery. Template engine questions matter most when you're hiring for admin dashboards, internal tools, or older monolithic apps where the backend still renders HTML directly. Skipping this topic in your express js interview questions list can leave a gap if the role touches anything beyond a pure API layer.
A candidate who can't explain why
express.static()needs correct path resolution has probably shipped a broken deployment before.
Sample questions and answers
These five questions check whether a candidate has actually configured views and static assets, not just consumed a starter template:
- What template engines work with Express, and how do you configure one? EJS, Pug, and Handlebars are common choices, set via
app.set('view engine', 'ejs')andapp.set('views', './views'). - How does
res.render()differ fromres.send()?res.render()compiles a view template with passed data into HTML before sending it;res.send()sends a raw response with no templating step. - How do you serve static files like CSS, images, or client-side JS? Through
express.static(), pointing at a public directory, so requests for those paths skip route handlers entirely. - What security risk comes with serving static files carelessly? Exposing an entire project directory instead of a scoped public folder, which can leak source code or config files.
- When would you choose server-side rendering over a separate frontend framework? For SEO-sensitive pages, internal admin panels, or projects where a full client-side build adds unnecessary complexity.
What interviewers are really testing
These questions reveal whether a candidate understands full-stack rendering tradeoffs, not just API design in isolation. Someone who's configured express.static() correctly, scoping it to a public folder rather than the project root, shows attention to deployment hygiene. Watch for candidates who dismiss template engines as outdated without acknowledging that plenty of production systems still rely on them for speed and simplicity.
7. Security best practices
Security gaps in Express apps rarely come from exotic attacks. They come from missing headers, unsanitized input, and defaults left unchanged since the tutorial stage. Security questions in an Express.js interview separate candidates who've hardened a real production API from those who've only ever deployed to a personal project behind no real traffic. Any thorough set of interview questions on express js should test whether a candidate treats security as a baseline requirement, not an optional add-on for later.

A candidate who can't name a single Express security header has probably never had an app scanned by a real security team.
Sample questions and answers
Run through these five questions to gauge whether security awareness is real or superficial:
- What does
helmetdo, and why is it commonly used in Express apps? It sets a collection of HTTP headers, likeContent-Security-PolicyandX-Frame-Options, that reduce common attack vectors such as clickjacking and MIME sniffing. - How do you prevent NoSQL or SQL injection in an Express app? Parameterized queries or an ORM's built-in escaping, plus never concatenating raw user input into a query string.
- What's the purpose of
cors, and what risk does misconfiguring it create? It controls which origins can call your API; setting it to allow all origins in production exposes the app to unwanted cross-origin requests. - How would you protect against brute-force login attempts? Rate limiting middleware like
express-rate-limit, combined with account lockouts after repeated failures. - Why should you avoid exposing detailed error messages or stack traces to end users? They can reveal internal file paths, library versions, or logic that attackers use to plan further exploits.
What interviewers are really testing
Questions here test whether a candidate has actually hardened a deployed API, not just read about security in passing. Someone who names specific middleware and explains the exact threat it mitigates shows real experience over memorized buzzwords. For a deeper reference during screening, the OWASP Top Ten is a useful checklist to compare against a candidate's answers.
8. Authentication and authorization
Authentication questions catch candidates who've only ever copy-pasted a login tutorial without understanding what happens after the password check succeeds. Authentication and authorization questions test whether a candidate can distinguish who a user is from what that user is allowed to do, a distinction that gets sloppy fast in real codebases. Skipping this topic in your express js interview questions and answers list leaves a blind spot for any role touching user accounts, admin panels, or protected APIs.
A candidate who treats authentication and authorization as the same thing has probably shipped an endpoint that lets any logged-in user access someone else's data.
Sample questions and answers
Use these five questions to separate real session and token experience from surface-level familiarity:
- What's the difference between authentication and authorization? Authentication verifies identity, confirming a user is who they claim to be. Authorization determines what an authenticated user can do or access. A candidate who conflates the two usually hasn't built role-based access into a real app.
- How does session-based authentication work in Express? A session ID is stored server-side (or in a store like Redis), and a cookie sent to the client references that session on each request, typically via
express-session. - How does JWT-based authentication differ from sessions? JWTs are stateless, the token itself carries encoded claims, and the server verifies a signature rather than looking up a stored session, which helps horizontal scaling.
- How would you implement role-based access control in Express middleware? A middleware function checks the authenticated user's role against the route's required permission before calling
next(), rejecting with a 403 otherwise. - Where should you store JWTs on the client, and why does it matter? Storing tokens in HTTP-only cookies rather than local storage reduces exposure to cross-site scripting attacks.
What interviewers are really testing
These questions reveal whether a candidate has actually secured protected routes in production, not just followed a passport.js tutorial once. Someone who can explain token expiration, refresh strategies, and middleware-based permission checks demonstrates real ownership of user-facing systems. Vague answers here often predict authorization bugs that let one user quietly access another user's records.
9. Database integration
Database integration questions reveal whether a candidate can connect Express to a real data layer without leaking connections or writing queries that fall apart under load. Database integration questions matter because Express itself is database-agnostic, so every project makes different choices between SQL and NoSQL, and a candidate needs to justify those choices rather than default to whatever they used last. This section rounds out any list of express js interview questions by moving past routing and middleware into how data actually flows through the app.
A candidate who can't explain connection pooling has probably crashed a production database by opening a new connection per request.
Sample questions and answers
Run through these five questions to check whether database experience is practical, not just theoretical:
- How do you connect Express to MongoDB versus PostgreSQL? MongoDB typically uses Mongoose for schema-based modeling and connection handling. PostgreSQL usually goes through
pgdirectly or an ORM like Sequelize or Prisma, which manage connection pooling and migrations; if the role leans relational, follow up with SQL interview questions and answers. - What's a connection pool, and why does it matter? A pool reuses a fixed set of open database connections instead of opening a new one per request, which prevents exhausting the database under concurrent load.
- How would you structure database logic to keep it out of route handlers? A separate service or repository layer that route handlers call into, keeping query logic testable and reusable across endpoints.
- What's the risk of running database queries directly inside a route handler with no validation? Unvalidated input reaching the query layer opens the door to injection attacks and unpredictable data shapes crashing downstream code.
- How do you handle database errors versus application errors differently? Database errors (timeouts, constraint violations) usually need retry logic or specific status codes, while application errors are logic failures that should map to clear client-facing messages.
What interviewers are really testing
These questions test whether a candidate treats the data layer as a distinct concern from routing, or whether everything lives tangled together in one file. Someone who mentions pooling, migrations, and a clean separation between routes and queries has clearly maintained a real production database, not just a local seed script. Weak answers here often predict the kind of app that works fine in development and falls over the moment real concurrent traffic hits it.
10. Testing Express applications
Many candidates can write an Express route but freeze the moment you ask how they'd verify it actually works before shipping. Testing questions separate developers who treat tests as an afterthought from those who build them into the development cycle from day one. This section belongs in any serious set of express js interview questions and answers, because untested routes are where regressions hide until a customer finds them first.
A candidate who can't explain the difference between a unit test and an integration test has probably never caught a regression before it reached production.
Sample questions and answers
Run through these five questions to gauge whether testing experience is real or just theoretical:
- What's the difference between unit tests and integration tests for an Express app? Unit tests isolate a single function or middleware, often mocking dependencies. Integration tests spin up the app and verify a full request-response cycle, including database calls where relevant.
- What tools would you use to test Express routes? Common answers mention Jest or Mocha as the test runner, paired with Supertest to send simulated HTTP requests directly against the Express app without needing a running server.
- How do you test middleware in isolation? By calling the middleware function directly with mock
req,res, andnextobjects, then asserting on what each one received or whethernext()fired. - How would you mock a database call in a test? Using a mocking library or an in-memory database like
mongodb-memory-server, so tests don't depend on a live production database. - What's the value of testing error paths, not just happy paths? Error paths are where most production incidents originate, so verifying a route returns the correct status code and message on failure catches bugs the happy path never reveals.
What interviewers are really testing
These questions check whether a candidate treats test coverage as part of building the feature, not a chore bolted on afterward. Someone who can describe mocking a database connection or testing an error-handling middleware in isolation has clearly shipped code that other people depended on. Silence or vague hand-waving here often predicts a codebase with no safety net, where every deploy is a gamble.
11. Performance, scaling, and clustering
Getting an Express app running is easy. Keeping it fast under real traffic is where senior candidates separate themselves from everyone else. Performance questions test whether someone has actually diagnosed a slow endpoint in production, not just read about caching in passing. Since Node.js runs on a single thread, any set of express js interview questions and answers aimed at senior roles needs to probe how a candidate scales across CPU cores and handles load without a single blocking operation taking down the whole process.

A candidate who can't explain the Node.js cluster module has probably never scaled an API past a single core.
Sample questions and answers
Use these five questions to check whether scaling knowledge comes from experience or theory:
- How does the Node.js cluster module help an Express app scale? It forks multiple worker processes, each running its own event loop, so a multi-core machine can handle concurrent requests across all cores instead of just one.
- What's the difference between clustering and load balancing with something like Nginx? Clustering scales a single machine across its cores; a load balancer distributes traffic across multiple machines or containers, and most production setups use both together.
- How would you cache expensive database queries in Express? An in-memory store like Redis, keyed by query parameters, with a sensible expiration time to avoid serving stale data.
- What causes memory leaks in a long-running Express process? Unbounded caches, unclosed database connections, or event listeners that accumulate without cleanup over time.
- How would you identify a performance bottleneck in production? Profiling with Node's built-in profiler or an APM tool, then checking for blocking synchronous code, slow queries, or missing indexes.
What interviewers are really testing
Beneath the terminology, these questions test whether a candidate has actually operated an Express app under load, not just deployed one and walked away. Someone who mentions specific metrics, response times, memory graphs, or query counts, shows they've owned uptime, not just written features. Weak answers here often predict a service that works fine in a demo and buckles the first time real traffic arrives.
12. Advanced architecture and scaffolding
Senior roles need more than someone who can wire up a route and call it done. Architecture questions test whether a candidate can structure an Express app that survives a team of ten engineers working on it simultaneously, not just a solo side project. Interview questions on express js at this level probe folder structure, dependency injection, and how someone would rebuild the framework's defaults into something a large team can actually maintain without stepping on each other's code.
A candidate who can't explain MVC in the context of Express has probably only ever worked in a single flat routes file.
Sample questions and answers
Use these five questions to separate candidates who've architected real systems from those who've only followed a starter kit:
- How would you structure a large Express application? A layered approach, separating routes, controllers, services, and data access, keeps each concern testable and replaceable. Strong candidates mention a
srcfolder split by domain rather than by file type. - What is dependency injection, and does it apply to Express? Passing dependencies like a database client or config object into modules explicitly, rather than importing them globally, makes unit testing and swapping implementations far easier.
- How would you build a plugin or module system on top of Express? Dynamically loading routers or middleware based on config, letting features toggle without touching core application code.
- What's the tradeoff between a monolithic Express app and microservices? A monolith is simpler to deploy and debug early on; microservices add operational complexity but let teams scale and deploy independently as the product grows.
- How would you handle configuration across development, staging, and production environments? Environment variables loaded through a config module, never hardcoded values scattered through route files.
What interviewers are really testing
Beneath these questions, you're checking whether a candidate thinks about long-term maintainability, not just shipping a working feature today. Someone who can justify a folder structure and explain why they'd introduce a service layer shows they've owned a codebase past its first six months. Weak answers here often predict a project that's easy to start but painful for the next hire to touch.
13. Practical coding exercises
Talking through concepts only proves so much. Practical coding exercises show whether a candidate can actually produce working Express code under mild pressure, not just describe it in the abstract. Any complete list of express js interview questions and answers needs a hands-on component, since plenty of candidates recite middleware theory fluently but freeze the moment you ask them to write it.
A candidate who can talk about middleware for ten minutes but can't write five lines of it has probably never shipped real code.
Sample questions and answers
Give candidates 15 to 20 minutes on a shared editor for these five exercises, and keep a set of live JavaScript coding interview questions handy if you want to push further:
- Write a route that returns a 404 for any unmatched path. Strong candidates place a catch-all handler after every other route, using
app.use()with no path, since Express matches in registration order. - Build a middleware that rate-limits requests per IP address. Expect a simple in-memory counter keyed by
req.ip, with an expiration window, even without reaching for a library likeexpress-rate-limit. - Write an async route handler that safely catches a rejected promise. Look for a try/catch block that calls
next(err)on failure, or a wrapper utility that forwards rejections automatically. - Implement a route that validates a request body before hitting the database. A quick check for required fields, or a schema library like Joi or Zod, before any query runs.
- Refactor a bloated route handler into a controller and service layer. This tests whether a candidate can apply the architecture concepts from the previous section under real time pressure, not just describe them.
// Example: safe async wrapper candidates should recognize or write
const asyncHandler = (fn) => (req, res, next) =>
Promise.resolve(fn(req, res, next)).catch(next);
What interviewers are really testing
Exercises like these confirm whether a candidate's spoken knowledge matches their typing speed, since plenty of people can explain a concept fluently but stall writing it from scratch. Candidates who ask clarifying questions before coding, about validation rules or expected status codes, usually write cleaner production code too. Skipping this step and relying only on verbal express js interview questions leaves you guessing whether a hire can actually deliver.
Walking into your Express.js interview ready
Running through these 35 questions gives you a structured way to separate candidates who've actually shipped Express code from those who've only memorized syntax. Depth beats breadth here: a candidate who can explain middleware order, error handling, and clustering tradeoffs in their own words is worth more than one who rattles off definitions without context. Use the difficulty progression to match your screening to the role, junior hires need to clear the fundamentals and routing sections cleanly, while senior candidates should hold their own through architecture and performance too.
Reading answers off a page only gets you so far, though. Verified, hands-on screening is what actually confirms a candidate can deliver under real conditions, not just talk well in an interview room. If you'd rather validate these answers at scale before scheduling a single live round, hire vetted Express JS developers from Olibr and start shortlisting candidates who've already been screened.
For engineers
Find work worth your time.
Live engineering roles across India and the US, matched to your stack. Build a profile recruiters actually discover.