Complete the code to send a JSON response with status 200.
res.status(200).[1]({ message: 'Success' });
The json method sends a JSON response and allows chaining after setting status.
Complete the code to set a header and send a plain text response.
res.set('Content-Type', 'text/plain').[1]('Hello World');
The send method sends the response body and supports chaining after setting headers.
Fix the error in chaining to set status and send a response.
res.[1](404).send('Not Found');
The correct method to set status for chaining is status. sendStatus sends the response immediately and does not allow chaining.
Fill both blanks to set a cookie and send a JSON response.
res.[1]('token', 'abc123').[2]({ success: true });
The cookie method sets a cookie and allows chaining. The json method sends a JSON response.
Fill all three blanks to set status, header, and send a plain text response.
res.[1](201).[2]('X-Custom', '123').[3]('Created');
Use status to set HTTP status, set to set headers, and send to send the response body as plain text.