add: stand configs
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
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 path from 'path';
|
||||
import {MySequence} from './sequence';
|
||||
|
||||
export {ApplicationConfig};
|
||||
|
||||
export class Loopback4ExampleGithubApplication extends BootMixin(
|
||||
ServiceMixin(RepositoryMixin(RestApplication)),
|
||||
) {
|
||||
constructor(options: ApplicationConfig = {}) {
|
||||
super(options);
|
||||
|
||||
// Подключаем кастомную sequence для обработки запросов.
|
||||
this.sequence(MySequence);
|
||||
|
||||
// Главная страница из папки public.
|
||||
this.static('/', path.join(__dirname, '../public'));
|
||||
|
||||
// Включаем REST Explorer.
|
||||
this.configure(RestExplorerBindings.COMPONENT).to({
|
||||
path: '/explorer',
|
||||
});
|
||||
this.component(RestExplorerComponent);
|
||||
|
||||
this.projectRoot = __dirname;
|
||||
// Настройки автозагрузки контроллеров.
|
||||
this.bootOptions = {
|
||||
controllers: {
|
||||
// Ищем контроллеры в папке controllers.
|
||||
dirs: ['controllers'],
|
||||
extensions: ['.controller.js'],
|
||||
nested: true,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user