import { AuthenticationComponent } from '@loopback/authentication' ; import { JWTAuthenticationComponent , MyUserService , UserServiceBindings , } from '@loopback/authentication-jwt' ; import { BootMixin } from '@loopback/boot' ; import { ApplicationConfig } from '@loopback/core' ; import { RepositoryMixin } from '@loopback/repository' ; import { RestApplication } from '@loopback/rest' ; import { RestExplorerBindings , RestExplorerComponent , } from '@loopback/rest-explorer' ; import { ServiceMixin } from '@loopback/service-proxy' ; import path from 'path' ; import { DbDataSource } from './datasources' ; import { MySequence } from './sequence' ; export { ApplicationConfig } ; export class TodoListApplication extends BootMixin ( ServiceMixin ( RepositoryMixin ( RestApplication ) ) ) { constructor ( options = { } ) { super ( options ) ; this . sequence ( MySequence ) ; this . static ( '/' , path . join ( __dirname , '../public' ) ) ; this . configure ( RestExplorerBindings . COMPONENT ) . to ( { path : '/explorer' , } ) ; this . component ( RestExplorerComponent ) ; this . projectRoot = __dirname ; this . bootOptions = { controllers : { dirs : [ 'controllers' ] , extensions : [ '.controller.js' ] , nested : true , } , } ; this . component ( AuthenticationComponent ) ; this . component ( JWTAuthenticationComponent ) ; this . dataSource ( DbDataSource , UserServiceBindings . DATASOURCE_NAME ) ; this . bind ( UserServiceBindings . USER_SERVICE ) . toClass ( MyUserService ) ; } }