Skip to content

Commit

Permalink
docs: clarify what is a Repository
Browse files Browse the repository at this point in the history
  • Loading branch information
bajtos committed Jan 29, 2019
1 parent e6a8d73 commit 8672b7f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/site/Model.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ A model describes business domain objects, for example, `Customer`, `Address`,
and `Order`. It usually defines a list of properties with name, type, and other
constraints.

{% include note.html content="Models describe the shape of data. Behavior like CRUD operations is added by repositories. 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." %}

Models can be used for data exchange on the wire or between different systems.
For example, a JSON object conforming to the `Customer` model definition can be
passed in REST/HTTP payload to create a new customer or stored in a document
Expand Down
4 changes: 4 additions & 0 deletions docs/site/Repositories.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ 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.

{% 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." %}

A `Repository` can be defined and implemented by application developers.
LoopBack ships a few predefined `Repository` interfaces for typical CRUD and KV
operations. These `Repository` implementations leverage `Model` definition and
Expand Down

0 comments on commit 8672b7f

Please sign in to comment.