import { inject } from '@loopback/core' ; import { get , param } from '@loopback/rest' ; import { GreetingService } from '../services' ; export class GreetingController { constructor ( @ inject ( 'services.GreetingService' , { asProxyWithInterceptors : true } ) private greetingService ) { } @ get ( '/greet/{name}' ) async greet ( @ param . path . string ( 'name' ) name , @ param . query . number ( 'count' ) count = 1 ) { const tasks = [ ] ; for ( let i = 0 ; i < count ; i ++ ) { tasks . push ( this . greetingService . greet ( name ) ) ; } return Promise . all ( tasks ) ; } }