Skip to content

Instantly share code, notes, and snippets.

@MrCube42
Created March 28, 2020 12:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrCube42/c643a1c09962c8b74ac7e272dc6814a9 to your computer and use it in GitHub Desktop.
Save MrCube42/c643a1c09962c8b74ac7e272dc6814a9 to your computer and use it in GitHub Desktop.
Annotation der GET-Route mit den Dekoratoren @Api… des Swagger Plugins.
import { ApiOperation, ApiResponse, ApiUseTags } from '@nestjs/swagger';
// ...
@ApiUseTags('companions')
@Controller('companions')
export class CompanionsController {
constructor(private service: CompanionsService) {}
@Get()
@ApiOperation({ title: 'Get all companions near you.' })
@ApiResponse({ status: 200, description: 'An array of companions near you.' })
async getAll(): Promise<Companion[]> {
return this.service.findAll();
}
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment