Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(docs): add diagrams to concepts #3462

Merged
merged 1 commit into from
Aug 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions docs/site/Behind-the-scene.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
lang: en
title: 'Components'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/Behind-the-scene.html
---

Here are the infrastructures that get all the artifacts working together:

- [Context](Context.md): An abstraction of states and dependencies in your
application that LoopBack uses to manage everything. It’s a global registry
for everything in your app (configurations, state, dependencies, classes and
so on).
- [Binding](Binding.md): An abstraction of items managed by a context. Each
binding has a unique key within the context and a value provider to resolve
the key to a value.
- [Dependency Injection](Dependency-injection.md): The technique used to
separate the construction of dependencies of a class or function from its
behavior to keep the code loosely coupled.
- [Component](Components.md): A package that bundles one or more LoopBack
extensions.
21 changes: 4 additions & 17 deletions docs/site/Concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ sidebar: lb4_sidebar
permalink: /doc/en/lb4/Concepts.html
---

LoopBack 4 introduces some new concepts that are important to understand:
LoopBack 4 defines some key building blocks to represent different
responsibilities for typical API and/or Microservice applications.

![Key concepts overview diagram](imgs/key-concepts-overview-diagram.png)

- [**Application**](Application.md): The central class for setting up all of
your module’s components, controllers, servers and bindings. The Application
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may need to refer to a lower layer that shows context, binding, and component.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopBack 4 defines some key building blocks to represent different responsibilities for typical API and/or Microservice applications.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may need to refer to a lower layer that shows context, binding, and component.

@raymondfeng , do you want to move those to the "behind the scene" sidebar?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move "interceptor" to section "Behind-the-scene" as well?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interceptor probably should stay outside of Behind-the-scene.

Expand All @@ -18,19 +21,6 @@ LoopBack 4 introduces some new concepts that are important to understand:
typically listens on a specific endpoint (protocol/host/port), handles
incoming requests, and then returns appropriate responses.

- [**Context**](Context.md): An abstraction of states and dependencies in your
application that LoopBack uses to manage everything. It's a global registry
for everything in your app (configurations, state, dependencies, classes and
so on).

- [**Binding**](Binding.md): An abstraction of items managed by a context. Each
binding has a unique key within the context and a value provider to resolve
the key to a value.

- [**Dependency Injection**](Dependency-injection.md): The technique used to
separate the construction of dependencies of a class or function from its
behavior to keep the code loosely coupled.

- [**Controller**](Controllers.md): A class that implements operations defined
by the application’s REST API. It implements an application’s business logic
and acts as a bridge between the HTTP/REST API and domain/database models. A
Expand Down Expand Up @@ -65,6 +55,3 @@ LoopBack 4 introduces some new concepts that are important to understand:

- [**Decorator**](Decorators.md): The pattern used to annotate or modify your
class declarations and their members with metadata.

- [**Component**](Components.md): A package that bundles one or more LoopBack
extensions.
2 changes: 2 additions & 0 deletions docs/site/DataSources.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ A `DataSource` in LoopBack 4 is a named configuration for a Connector instance
that represents data in an external system. The Connector is used by
`legacy-juggler-bridge` to power LoopBack 4 Repositories for Data operations.

![Datasource diagram](imgs/datasource.png)

### Creating a DataSource

It is recommended to use the [`lb4 datasource` command](DataSource-generator.md)
Expand Down
2 changes: 2 additions & 0 deletions docs/site/Repositories.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ A `Repository` represents a specialized `Service` interface that provides
strong-typed data access (for example, CRUD) operations of a domain model
against the underlying database or service.

![Repository diagram](imgs/repository.png)

{% include note.html content="Repositories are adding behavior to Models. Models describe the shape of data, Repositories provide behavior like CRUD operations. This is different from LoopBack 3.x where models implement behavior too." %}

{% include tip.html content="A single model can be used with multiple different Repositories." %}
Expand Down
Binary file added docs/site/imgs/datasource.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/site/imgs/key-concepts-overview-diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/site/imgs/repository.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
97 changes: 51 additions & 46 deletions docs/site/sidebars/lb4_sidebar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,39 +32,48 @@ children:
url: Server.html
output: 'web, pdf'

- title: 'Context'
url: Context.html
- title: 'Controllers'
url: Controllers.html
output: 'web, pdf'

- title: 'Binding'
url: Binding.html
- title: 'Models'
url: Model.html
output: 'web, pdf'

- title: 'Dependency injection'
url: Dependency-injection.html
- title: 'Relations'
url: Relations.html
output: 'web, pdf'
children:

- title: 'Reserved binding keys'
url: Reserved-binding-keys.html
- title: 'HasMany Relation'
url: HasMany-relation.html
output: 'web, pdf'

- title: 'Controllers'
url: Controllers.html
- title: 'BelongsTo Relation'
url: BelongsTo-relation.html
output: 'web, pdf'

- title: 'HasOne Relation'
url: hasOne-relation.html
output: 'web, pdf'

- title: 'DataSources'
url: DataSources.html
output: 'web, pdf'

- title: 'Components'
url: Components.html
- title: 'Repositories'
url: Repositories.html
output: 'web, pdf'
children:

- title: 'Database Transactions'
url: Using-database-transactions.html
output: 'web, pdf'

- title: 'Interceptors'
url: Interceptors.html
output: 'web, pdf'

- title: 'DataSources'
url: DataSources.html
output: 'web, pdf'

- title: 'Life cycle events and observers'
url: Life-cycle.html
output: 'web, pdf'
Expand All @@ -86,36 +95,6 @@ children:
url: Parsing-requests.html
output: 'web, pdf'

- title: 'Model'
url: Model.html
output: 'web, pdf'

- title: 'Repositories'
url: Repositories.html
output: 'web, pdf'
children:

- title: 'Database Transactions'
url: Using-database-transactions.html
output: 'web, pdf'

- title: 'Relations'
url: Relations.html
output: 'web, pdf'
children:

- title: 'HasMany Relation'
url: HasMany-relation.html
output: 'web, pdf'

- title: 'BelongsTo Relation'
url: BelongsTo-relation.html
output: 'web, pdf'

- title: 'HasOne Relation'
url: hasOne-relation.html
output: 'web, pdf'

- title: 'Decorators'
url: Decorators.html
output: 'web, pdf'
Expand Down Expand Up @@ -200,6 +179,32 @@ children:
url: Serving-static-files.html
output: 'web, pdf'

- title: 'Behind the Scene'
url: Behind-the-scene.html
output: 'web, pdf'
children:

- title: 'Context'
url: Context.html
output: 'web, pdf'

- title: 'Binding'
url: Binding.html
output: 'web, pdf'

- title: 'Dependency Injection'
url: Dependency-injection.html
output: 'web, pdf'
children:

- title: 'Reserved binding keys'
url: Reserved-binding-keys.html
output: 'web, pdf'

- title: 'Components'
url: Components.html
output: 'web, pdf'

- title: 'Booting an Application'
url: Booting-an-Application.html
output: 'web, pdf'
Expand Down