import { BootMixin } from '@loopback/boot' ; import { ApplicationConfig } from '@loopback/core' ; import { RestExplorerBindings , RestExplorerComponent , } from '@loopback/rest-explorer' ; import { RepositoryMixin } from '@loopback/repository' ; import { RestApplication } from '@loopback/rest' ; import { ServiceMixin } from '@loopback/service-proxy' ; import { SchedulerServiceComponent } from '@sourceloop/scheduler-service' ; import * as dotenv from 'dotenv' ; import * as dotenvExt from 'dotenv-extended' ; import path from 'path' ; import { MySequence } from './sequence' ; export { ApplicationConfig } ; const port = 3000 ; export class SchedulerExampleApplication extends BootMixin ( ServiceMixin ( RepositoryMixin ( RestApplication ) ) ) { constructor ( options = { } ) { dotenv . config ( ) ; if ( process ?. env ?. NODE_ENV && process . env . NODE_ENV !== 'test' ) { dotenvExt . load ( { schema : '.env.example' , errorOnMissing : true , includeProcessEnv : true , } ) ; } else { dotenvExt . load ( { schema : '.env.example' , errorOnMissing : false , includeProcessEnv : true , } ) ; } options . rest = options . rest || { } ; options . rest . port = + ( process . env . PORT ?? port ) ; options . rest . host = process . env . HOST ; super ( options ) ; this . sequence ( MySequence ) ; this . static ( '/' , path . join ( __dirname , '../public' ) ) ; this . configure ( RestExplorerBindings . COMPONENT ) . to ( { path : '/explorer' , } ) ; this . component ( RestExplorerComponent ) ; this . component ( SchedulerServiceComponent ) ; this . projectRoot = __dirname ; this . bootOptions = { controllers : { dirs : [ 'controllers' ] , extensions : [ '.controller.js' ] , nested : true , } , } ; } }