Module 08 Β· The Walkers API, End to End β Lesson 3 of 3 Β· ~12 min
POST /walkers β create, and mapping the response
Create returns 201, not 200
POST /walkers brings a new walker into existence, so the honest status code is 201 Created, not 200. Nest already knows this: a @Post() handler defaults to 201 when it returns normally β you get the right code for free. (Reach for @HttpCode(200) only when you deliberately want to override it.)
The body is validated by the same DTO-plus-ValidationPipe pattern from module 06. Define what a create accepts β note it does not accept id, rating, or createdAt; those are the database's to assign, never the client's: