Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Vatsalya-singhi/2160599762bb9b67a4339d44918e1a1d to your computer and use it in GitHub Desktop.
Save Vatsalya-singhi/2160599762bb9b67a4339d44918e1a1d to your computer and use it in GitHub Desktop.
import { Controller, Post, Body, UsePipes, ValidationPipe } from '@nestjs/common';
import { CreateUserDto } from './create-user.dto';
@Controller('users')
export class UsersController {
@Post()
@UsePipes(new ValidationPipe()) // Apply validation
create(@Body() createUserDto: CreateUserDto) {
return { message: 'User created', data: createUserDto };
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment