Skip to content

Commit

Permalink
fix(lb4): Application fixup (#525)
Browse files Browse the repository at this point in the history
* fix(lb4): Move bindings into constructor call

* fix(lb4): Clarify calls to super.start/stop
  • Loading branch information
Kevin Delisle authored Nov 9, 2017
1 parent 9d2186c commit 30d1122
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions pages/en/lb4/Application.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,17 @@ export class WidgetApplication extends Application {
const server = await app.getServer(RestServer);
server.bind('rest.port').to(8080);
server.api(WidgetApi);
// The superclass start method will call start on all servers that are
// bound to the application.
return await super.start();
}

async stop() {
// This is where you would do whatever is necessary before stopping your
// app (graceful closing of connections, flushing buffers, etc)
console.log('Widget application is shutting down...')
// The superclass stop method will call stop on all servers that are
// bound to the application.
await super.stop();
}
}
Expand All @@ -84,14 +88,14 @@ bindings, like `component`, `server` and `controller`:
export class MyApplication extends Application {
constructor() {
super();
}
this.component(MagicSuite);
this.server(RestServer, 'public');
this.server(RestServer, 'private');
this.component(MagicSuite);
this.server(RestServer, 'public');
this.server(RestServer, 'private');

this.controller(FooController);
this.controller(BarController);
this.controller(BazController);
this.controller(FooController);
this.controller(BarController);
this.controller(BazController);
}
}
```

Expand Down

0 comments on commit 30d1122

Please sign in to comment.