1 Essential Express.js Interview Question *

question badge

What function arguments are available to Express.js route handlers?

answer badge

The arguments available to an Express.js route handler function are:

  • req - the request object
  • res - the response object
  • next (optional) - a function to pass control to one of the subsequent route handlers

The third argument may be omitted, but is useful in cases where you have a chain of handlers and you would like to pass control to one of the subsequent route handlers, and skip the current one.

* There is more to interviewing than tricky technical questions, so these are intended merely as a guide. Not every “A” candidate worth hiring will be able to answer them all, nor does answering them all guarantee an “A” candidate. At the end of the day, hiring remains an art, a science — and a lot of work.
Submit an interview question
Submitted questions and answers are subject to review and editing, and may or may not be selected for posting, at the sole discretion of Toptal, LLC.
All fields are required
Thanks for submitting your question.
Our editorial staff will review it shortly. Please note that submitted questions and answers are subject to review and editing, and may or may not be selected for posting, at the sole discretion of Toptal, LLC.
Looking for Express.js experts? Check out Toptal’s Express.js developers.
Johan Hernandez
Colombia
Johan is a mobile app and cloud back-end developer with over 15 years of experience. He's been telecommuting for startups in the USA since 2010. He has worked with enterprise stacks for a number of years, but more recently his primary focus has been on building native apps for mobile and desktop (Mac, iOS, Android and Windows) using Swift, Objective-C, Java, Kotlin, and C#. He also builds his own RESTful back-ends with Rails, Node, and Golang.