@Controller('users')
export class UsersController {
@Get()
async findAll() {
return this.usersService.findAll();
}
}
@Controller() and can use route decorators like @Get(), @Post()
@Injectable()
export class UsersService {
findAll(): Promise {}
}
@Injectable() to be injectable into other classes
@Module({
controllers: [UsersController],
providers: [UsersService]
})
@Controller()
@Get()
@Post()
@Injectable()
@Serialize(GetUserDto)
app.use(loggerMiddleware);
@UseInterceptors(LoggingInterceptor)
@UseInterceptors(SerializeInterceptor)
app.useGlobalPipes(new ValidationPipe());
@UseGuards(AuthGuard)
@UseGuards(RolesGuard)
@Catch(HttpException)
handleException(exception: HttpException) {}
@EventEmitter()
emit('user.created', user)