Arundathi Patil | 85db5b0 | 2019-01-17 14:10:08 +0530 | [diff] [blame] | 1 | /* |
| 2 | ============LICENSE_START========================================== |
| 3 | =================================================================== |
| 4 | Copyright (C) 2018-19 IBM Intellectual Property. All rights reserved. |
| 5 | =================================================================== |
| 6 | |
| 7 | Unless otherwise specified, all software contained herein is licensed |
| 8 | under the Apache License, Version 2.0 (the License); |
| 9 | you may not use this software except in compliance with the License. |
| 10 | You may obtain a copy of the License at |
| 11 | |
| 12 | http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | |
| 14 | Unless required by applicable law or agreed to in writing, software |
| 15 | distributed under the License is distributed on an "AS IS" BASIS, |
| 16 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 | See the License for the specific language governing permissions and |
| 18 | limitations under the License. |
| 19 | ============LICENSE_END============================================ |
| 20 | */ |
| 21 | |
| 22 | import { BootMixin } from '@loopback/boot'; |
| 23 | import { ApplicationConfig } from '@loopback/core'; |
| 24 | import { |
| 25 | RestExplorerBindings, |
| 26 | RestExplorerComponent, |
| 27 | } from '@loopback/rest-explorer'; |
| 28 | import { RepositoryMixin } from '@loopback/repository'; |
| 29 | import { RestApplication } from '@loopback/rest'; |
| 30 | import { ServiceMixin } from '@loopback/service-proxy'; |
| 31 | import * as path from 'path'; |
| 32 | import { MySequence } from './sequence'; |
| 33 | |
| 34 | export class CdsUiServerApplication extends BootMixin( |
| 35 | ServiceMixin(RepositoryMixin(RestApplication)), |
| 36 | ) { |
| 37 | constructor(options: ApplicationConfig = {}) { |
| 38 | super(options); |
| 39 | |
| 40 | // Set up the custom sequence |
| 41 | this.sequence(MySequence); |
| 42 | |
| 43 | // Set up default home page |
| 44 | this.static('/', path.join(__dirname, '../../public')); |
| 45 | |
| 46 | // Customize @loopback/rest-explorer configuration here |
| 47 | this.bind(RestExplorerBindings.CONFIG).to({ |
| 48 | path: '/explorer', |
| 49 | }); |
| 50 | this.component(RestExplorerComponent); |
| 51 | |
| 52 | this.projectRoot = __dirname; |
| 53 | // Customize @loopback/boot Booter Conventions here |
| 54 | this.bootOptions = { |
| 55 | controllers: { |
| 56 | // Customize ControllerBooter Conventions here |
| 57 | dirs: ['controllers'], |
| 58 | extensions: ['.controller.js'], |
| 59 | nested: true, |
| 60 | }, |
| 61 | }; |
| 62 | } |
| 63 | } |