Skip to content

Instantly share code, notes, and snippets.

@MrCube42
Created March 28, 2020 12:38
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/7345dd99b9f0475924ee6725bcf63c74 to your computer and use it in GitHub Desktop.
Save MrCube42/7345dd99b9f0475924ee6725bcf63c74 to your computer and use it in GitHub Desktop.
Injizierung des zuvor implementierten CompanionsService und dessen Verwendung innerhalb des Controllers.
export class CompanionsController {
constructor(private service: CompanionsService) {}
@Get()
async getAll(): Promise<Companion[]> {
return this.service.findAll();
}
@Get(':id')
async getCompanionDetails(@Param('id') id: string): Promise<CompanionDetails> {
return this.service.findDetailsById(id);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment