NestJS · Junior · Question 19 of 75
What happens if a controller method returns a plain object?
- 1Nest returns an empty response
- ✓Correct answer: Nest serializes it to JSON automatically
- 3Nest throws an error, you must call
res.send()
Explanation
Returning a value (or a promise) is the standard approach. Injecting the platform response with @Res() switches you to manual mode, where you must send the response yourself.