-
-
Save MrCube42/c643a1c09962c8b74ac7e272dc6814a9 to your computer and use it in GitHub Desktop.
Annotation der GET-Route mit den Dekoratoren @Api… des Swagger Plugins.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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