Skip to content

Commit

Permalink
feat: enable self-hosted API Explorer in example projects
Browse files Browse the repository at this point in the history
  • Loading branch information
bajtos committed Nov 12, 2018
1 parent 8c98798 commit 968d42e
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 3 deletions.
1 change: 1 addition & 0 deletions examples/soap-calculator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"@loopback/boot": "^1.0.3",
"@loopback/context": "^1.0.1",
"@loopback/core": "^1.0.1",
"@loopback/explorer": "^0.1.0",
"@loopback/openapi-v3": "^1.1.0",
"@loopback/repository": "^1.0.3",
"@loopback/rest": "^1.2.0",
Expand Down
5 changes: 4 additions & 1 deletion examples/soap-calculator/src/application.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import {BootMixin} from '@loopback/boot';
import {ApplicationConfig} from '@loopback/core';
import {ApiExplorerComponent} from '@loopback/explorer';
import {RepositoryMixin} from '@loopback/repository';
import {RestApplication} from '@loopback/rest';
import {ServiceMixin} from '@loopback/service-proxy';
import {MySequence} from './sequence';
import * as path from 'path';
import {MySequence} from './sequence';

export class SoapCalculatorApplication extends BootMixin(
ServiceMixin(RepositoryMixin(RestApplication)),
Expand All @@ -18,6 +19,8 @@ export class SoapCalculatorApplication extends BootMixin(
// Set up default home page
this.static('/', path.join(__dirname, '../../public'));

this.component(ApiExplorerComponent);

this.projectRoot = __dirname;
// Customize @loopback/boot Booter Conventions here
this.bootOptions = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,12 @@ describe('HomePage', () => {
.expect(200)
.expect('Content-Type', /text\/html/);
});

it('exposes self-hosted explorer', async () => {
await client
.get('/explorer/')
.expect(200)
.expect('Content-Type', /text\/html/)
.expect(/<title>LoopBack API Explorer/);
});
});
1 change: 1 addition & 0 deletions examples/todo-list/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@loopback/boot": "^1.0.3",
"@loopback/context": "^1.0.1",
"@loopback/core": "^1.0.1",
"@loopback/explorer": "^0.1.0",
"@loopback/openapi-v3": "^1.1.0",
"@loopback/openapi-v3-types": "^1.0.1",
"@loopback/repository": "^1.0.3",
Expand Down
5 changes: 4 additions & 1 deletion examples/todo-list/src/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@

import {BootMixin} from '@loopback/boot';
import {ApplicationConfig} from '@loopback/core';
import {ApiExplorerComponent} from '@loopback/explorer';
import {RepositoryMixin} from '@loopback/repository';
import {RestApplication} from '@loopback/rest';
import {MySequence} from './sequence';
import * as path from 'path';
import {MySequence} from './sequence';

export class TodoListApplication extends BootMixin(
RepositoryMixin(RestApplication),
Expand All @@ -22,6 +23,8 @@ export class TodoListApplication extends BootMixin(
// Set up default home page
this.static('/', path.join(__dirname, '../../public'));

this.component(ApiExplorerComponent);

this.projectRoot = __dirname;
// Customize @loopback/boot Booter Conventions here
this.bootOptions = {
Expand Down
8 changes: 8 additions & 0 deletions examples/todo-list/test/acceptance/home-page.acceptance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,12 @@ describe('HomePage', () => {
.expect(200)
.expect('Content-Type', /text\/html/);
});

it('exposes self-hosted explorer', async () => {
await client
.get('/explorer/')
.expect(200)
.expect('Content-Type', /text\/html/)
.expect(/<title>LoopBack API Explorer/);
});
});
1 change: 1 addition & 0 deletions examples/todo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@loopback/boot": "^1.0.3",
"@loopback/context": "^1.0.1",
"@loopback/core": "^1.0.1",
"@loopback/explorer": "^0.1.0",
"@loopback/openapi-v3": "^1.1.0",
"@loopback/openapi-v3-types": "^1.0.1",
"@loopback/repository": "^1.0.3",
Expand Down
5 changes: 4 additions & 1 deletion examples/todo/src/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@

import {BootMixin} from '@loopback/boot';
import {ApplicationConfig} from '@loopback/core';
import {ApiExplorerComponent} from '@loopback/explorer';
import {RepositoryMixin} from '@loopback/repository';
import {RestApplication} from '@loopback/rest';
import {ServiceMixin} from '@loopback/service-proxy';
import {MySequence} from './sequence';
import * as path from 'path';
import {MySequence} from './sequence';

export class TodoListApplication extends BootMixin(
ServiceMixin(RepositoryMixin(RestApplication)),
Expand All @@ -23,6 +24,8 @@ export class TodoListApplication extends BootMixin(
// Set up default home page
this.static('/', path.join(__dirname, '../../public'));

this.component(ApiExplorerComponent);

this.projectRoot = __dirname;
// Customize @loopback/boot Booter Conventions here
this.bootOptions = {
Expand Down
8 changes: 8 additions & 0 deletions examples/todo/test/acceptance/home-page.acceptance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,12 @@ describe('HomePage', () => {
.expect(200)
.expect('Content-Type', /text\/html/);
});

it('exposes self-hosted explorer', async () => {
await client
.get('/explorer/')
.expect(200)
.expect('Content-Type', /text\/html/)
.expect(/<title>LoopBack API Explorer/);
});
});

0 comments on commit 968d42e

Please sign in to comment.