Skip to content

Commit

Permalink
Merge 56c8acd into 1b5b66a
Browse files Browse the repository at this point in the history
  • Loading branch information
hacksparrow committed Dec 4, 2018
2 parents 1b5b66a + 56c8acd commit b4645ed
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
10 changes: 6 additions & 4 deletions docs/site/Booting-an-Application.md
Expand Up @@ -46,10 +46,12 @@ package (with custom booters).
## BootMixin

Boot functionality can be added to a LoopBack 4 Application by mixing it with
the `BootMixin`. The Mixin adds the `BootComponent` to your Application as well
as convenience methods such as `app.boot()` and `app.booters()`. The Mixin also
allows Components to set the property `booters` as an Array of `Booters`. They
will be bound to the Application and called by the `Bootstrapper`.
the `BootMixin`
[mixin](https://www.typescriptlang.org/docs/handbook/mixins.html). This mixin
adds the `BootComponent` to your Application as well as convenience methods such
as `app.boot()` and `app.booters()`. The Mixin also allows Components to set the
property `booters` as an Array of `Booters`. They will be bound to the
Application and called by the `Bootstrapper`.

Since this is a convention-based Bootstrapper, it is important to set a
`projectRoot`, as all other artifact paths will be resolved relative to this
Expand Down
17 changes: 17 additions & 0 deletions docs/site/Creating-components.md
Expand Up @@ -31,6 +31,23 @@ export class MyComponent implements Component {
}
```

You can inject anything to from the context and access them from a component. In
the following example the REST server instance is made available in the
component via dependency injection.

```ts
import {Component, CoreBindings} from '@loopback/core';
import {RestApplication} from '@loopback/rest';
export class MyComponent implements Component {
constructor(
@inject(CoreBindings.APPLICATION_INSTANCE)
private application: RestApplication,
) {
// The rest server instance can be accessed from this component
}
}
```

When a component is mounted to an application, a new instance of the component
class is created and then:

Expand Down
2 changes: 1 addition & 1 deletion docs/site/Server.md
Expand Up @@ -145,7 +145,7 @@ Hosting the API Explorer at an external URL has a few downsides, for example a
working internet connection is required to explore the API. As a recommended
alternative, LoopBack comes with an extension that provides a self-hosted
Explorer UI. Please refer to
[Self-hosted REST API Explorer](./Self-hosted-rest-api-explorer.md) for more
[Self-hosted REST API Explorer](Self-hosted-rest-api-explorer.md) for more
details.

### Enable HTTPS
Expand Down

0 comments on commit b4645ed

Please sign in to comment.