Skip to content

Commit

Permalink
fix(example-getting-started): use RestApplication (#955)
Browse files Browse the repository at this point in the history
- use RestApplication in `example-getting-started` instead of `Application`
- add in `@loopback/openapi-spec` as a dependency in `example-getting-started`
  • Loading branch information
shimks committed Feb 5, 2018
1 parent 75479f4 commit 3829878
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
1 change: 1 addition & 0 deletions packages/example-getting-started/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"dependencies": {
"@loopback/context": "^4.0.0-alpha.30",
"@loopback/core": "^4.0.0-alpha.32",
"@loopback/openapi-spec": "^4.0.0-alpha.24",
"@loopback/openapi-v2": "^4.0.0-alpha.9",
"@loopback/repository": "^4.0.0-alpha.28",
"@loopback/rest": "^4.0.0-alpha.24",
Expand Down
14 changes: 3 additions & 11 deletions packages/example-getting-started/src/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

import {Application, ApplicationConfig} from '@loopback/core';
import {RestComponent} from '@loopback/rest';
import {ApplicationConfig} from '@loopback/core';
import {RestApplication} from '@loopback/rest';
import {TodoController} from './controllers';
import {TodoRepository} from './repositories';
import {db} from './datasources/db.datasource';
Expand All @@ -18,7 +18,7 @@ import {
RepositoryMixin,
} from '@loopback/repository';
/* tslint:enable:no-unused-imports */
export class TodoApplication extends RepositoryMixin(Application) {
export class TodoApplication extends RepositoryMixin(RestApplication) {
constructor(options?: ApplicationConfig) {
// TODO(bajtos) The comment below does not make sense to me.
// Consumers of TodoApplication object should not be changing the shape
Expand All @@ -27,14 +27,6 @@ export class TodoApplication extends RepositoryMixin(Application) {
// which database to connect to, etc.
// See https://github.com/strongloop/loopback-next/issues/742

// Allow options to replace the defined components array, if desired.
options = Object.assign(
{},
{
components: [RestComponent],
},
options,
);
super(options);
this.setupRepositories();
this.setupControllers();
Expand Down

0 comments on commit 3829878

Please sign in to comment.