Which property of the response object is used to send an HTTP status code to the client?
- statusCode
- status
- httpStatus
- responseCode
To send an HTTP status code to the client in Node.js, you use the statusCode property of the response object. For example, response.statusCode = 200; sets the status code to 200 (OK). The other options are not standard properties for setting the status code.
Loading...
Related Quiz
- In JavaScript, ______ is a primitive data type that can only have values true or false.
- You are designing an authentication system for a new API. The API will be accessed by both web clients and other services. Which authentication strategy would be most suitable to ensure security and scalability?
- How can you handle errors in middleware in Express.js?
- Which method is used to attach a listener to an event in the Events module of Node.js?
- In Express.js, how can you handle errors occurring in asynchronous code within a route handler?