Skip to content

Commit

Permalink
chore: update files to match latest CLI template output
Browse files Browse the repository at this point in the history
Signed-off-by: virkt25 <taranveer@virk.cc>
  • Loading branch information
virkt25 committed Aug 15, 2018
1 parent bd02f45 commit d92fb37
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,25 @@
// License text available at https://opensource.org/licenses/MIT

import {ApplicationConfig} from '@loopback/core';
import {RestApplication, RestServer, RestBindings} from '@loopback/rest';
import {RestApplication} from '@loopback/rest';
import {MySequence} from './sequence';

/* tslint:disable:no-unused-variable */
// Binding and Booter imports are required to infer types for BootMixin!
import {BootMixin, Booter, Binding} from '@loopback/boot';

// juggler imports are required to infer types for RepositoryMixin!
import {
Class,
Repository,
RepositoryMixin,
juggler,
} from '@loopback/repository';
/* tslint:enable:no-unused-variable */

export class ShoppingApplication extends BootMixin(RestApplication) {
export class ShoppingApplication extends BootMixin(
RepositoryMixin(RestApplication),
) {
constructor(options?: ApplicationConfig) {
super(options);

Expand All @@ -30,13 +40,4 @@ export class ShoppingApplication extends BootMixin(RestApplication) {
},
};
}

async start() {
await super.start();

const server = await this.getServer(RestServer);
const port = await server.get(RestBindings.PORT);
console.log(`Server is running at http://127.0.0.1:${port}`);
console.log(`Try http://127.0.0.1:${port}/ping`);
}
}
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,10 @@ export async function main(options?: ApplicationConfig) {
const app = new ShoppingApplication(options);
await app.boot();
await app.start();

const url = app.restServer.url;
console.log(`Server is running at ${url}`);
console.log(`Try ${url}/ping`);

return app;
}

0 comments on commit d92fb37

Please sign in to comment.