export * from '@loopback/http-server' ; export * from './recommendation-grpc' ; export * from './recommendation-rest' ; import { grpcMain } from './recommendation-grpc' ; import { restMain } from './recommendation-rest' ; export async function main ( config = { rest : { port : 3001 } , grpc : { } } ) { const protocol = process . env . RECOMMENDER_PROTOCOL ; if ( config . rest ) { if ( protocol == null || protocol === 'rest' ) await restMain ( config . rest . port , config . rest . host ) ; } if ( config . grpc ) { if ( protocol == null || protocol === 'grpc' ) { grpcMain ( config . grpc . port ) . catch ( err => { console . error ( err ) ; process . exit ( 1 ) ; } ) ; } } } if ( require . main === module ) { main ( ) . catch ( err => { console . error ( 'Cannot start the application.' , err ) ; process . exit ( 1 ) ; } ) ; }