Update the concepts.md and link to related guides
This commit is contained in:
parent
c604c708cf
commit
09113a955d
|
@ -2,47 +2,85 @@
|
|||
|
||||
###Model
|
||||
|
||||
LoopBack is centered around models. A model is an object that encapsulates data. A model is usually named after its real life counterpart. Like its real life counterpart a model has properties or attributes.
|
||||
LoopBack is centered around models. A model is an object that encapsulates data. A model is usually named after its
|
||||
real life counterpart. Like its real life counterpart, a model has some properties. Each property has a name, a type,
|
||||
and other attributes. For example,
|
||||
|
||||
model: Person
|
||||
|
||||
Example)
|
||||
properties:
|
||||
- a Person model has properties such as First Name, Last Name and Birthday.
|
||||
- First Name and Last Name are strings while Birthday is date.
|
||||
|
||||
model = person
|
||||
a person model has properties such as a First Name and Last Name
|
||||
A model can also do things as actions and behaviors. Some actions are common to all instances of the same model while
|
||||
others are specific to a given instance. For example,
|
||||
|
||||
A model can also do things as actions and behavior.
|
||||
model: Person
|
||||
|
||||
Example)
|
||||
actions:
|
||||
- a Person model can say his/her Full Name (relying on a given instance)
|
||||
- a Person model can find people by Last Name (independent of instances)
|
||||
|
||||
model = person
|
||||
a person model can speak and say his/her Full Name
|
||||
Models are the vehicle for data exchange and data representation across different layers in LoopBack. For example, the
|
||||
Person model is available as database tables, Node.js classes, REST resources, and mobile SDK objects.
|
||||
|
||||
When developing your mobile applications, think of models being the "M" in your MVC framework. Models in LoopBack have backend connectivty built in already, so that you can save data back to your backend and call actions or functions run on the backend seamlessly from your mobile application.
|
||||
When developing your mobile applications, think of models being the "M" in your MVC framework. Models in LoopBack have
|
||||
backend connectivity built in already, so that you can save data back to your backend and call actions or functions run
|
||||
on the backend seamlessly from your mobile application.
|
||||
|
||||
###LoopBack Definition Language (LDL)
|
||||
All models in LoopBack can be represented as JSON objects. LoopBack has utilized and extended JSON to define a model's properties and structure. The JSON that is utilized to help define a model's properties and stucture or schema is called LoopBack Definition Language (LDL). LDL is a type of domain specific language <insert link>
|
||||
|
||||
Example)
|
||||
All models in LoopBack can be described as JSON objects. LoopBack has utilized and extended JSON to define a model's
|
||||
properties and structure. The JSON that is utilized to help define a model's properties and structure or schema is called
|
||||
LoopBack Definition Language (LDL). LDL is simple DSL to define data models in JavaScript or plain JSON. The model
|
||||
definitions establish common knowledge of data in LoopBack. For example,
|
||||
|
||||
model = person
|
||||
{firstname : string, lastname : string, age: number}
|
||||
model: Person
|
||||
|
||||
definition in LDL:
|
||||
{
|
||||
"firstName" : "string",
|
||||
"lastName" : "string",
|
||||
"birthday": "date"
|
||||
}
|
||||
|
||||
For more information, please read [LoopBack Definition Language Guide](/loopback-datasource-juggler/#loopback-definition-language-guide).
|
||||
|
||||
###Datasources and Connectors
|
||||
|
||||
LoopBack allows you to connect to many sources of data and services in the cloud and on premise in your datacenter. These sources of data and services are called Datasources.
|
||||
LoopBack allows you to connect to many sources of data and services in the cloud and on premise in your data center.
|
||||
These sources of data and services are called DataSources. DataSources are accessed through a plugin called a Connector
|
||||
in LoopBack. Plugins are highly customizable and extensible. Unlike other mobile backend, LoopBack can leverage your
|
||||
existing data and organize them in the form of models.
|
||||
|
||||
Datasources are accessed through a plugin called a Connector in LoopBack. Plugins are highly customizable and extensible. Unlike other mobile backend, LoopBack can leverage your existing data and organize them in the form of models.
|
||||
The concept of DataSource is introduced to encapsulate business logic to exchange data between models and various data sources.
|
||||
Data sources are typically databases that provide create, retrieve, update, and delete (CRUD) functions. LoopBack also generalize
|
||||
other backend services, such as REST APIs, SOAP Web Services, and Storage Services, as data sources.
|
||||
|
||||
#### Discovery
|
||||
#### Supported Connectors
|
||||
#### Connector Spec
|
||||
Data sources are backed by connectors which implement the data exchange logic using database drivers or other client APIs.
|
||||
In general, connectors are not used directly by application code. The DataSource class provides APIs to configure the
|
||||
underlying connector and exposes functions via DataSource or model classes.
|
||||
|
||||
#### LoopBack Connector Modules
|
||||
|
||||
| Type | Package Name |
|
||||
| --------- |:--------------------------------------------------------------------------------------:|
|
||||
| Memory | [Built-in](https://github.com/strongloop/loopback-datasource-juggler) |
|
||||
| MongoDB | [loopback-connector-mongodb](https://github.com/strongloop/loopback-connector-mongodb) |
|
||||
| Oracle | [loopback-connector-oracle](https://github.com/strongloop/loopback-connector-oracle) |
|
||||
| REST | [loopback-connector-rest](https://github.com/strongloop/loopback-connector-rest) |
|
||||
|
||||
For more information, please read [LoopBack DataSource and Connector Guide](/loopback-datasource-juggler/#loopback-datasource-and-connector-guide).
|
||||
|
||||
### REST
|
||||
|
||||
Everything defined in LoopBack is availabe to you as a REST endpoint. For every model that is created in LoopBack, a REST endpoint is automatically created for you. You can see and experiment with your REST api using the <insert link>> LoopBack API Explorer.
|
||||
Everything defined in LoopBack is available to you as a REST endpoint. For every model that is created in LoopBack, a
|
||||
REST endpoint is automatically created for you. You can see and experiment with your REST api using the [LoopBack API Explorer](http://localhost:3000/explorer/).
|
||||
|
||||
LoopBack also supports other protocols for your API as well. Socket.io is another protocol that is currently being developed.
|
||||
|
||||
For more information, please read [Model REST APIs](/loopback#model-rest-api).
|
||||
|
||||
### Mix In
|
||||
|
||||
### Remoting
|
||||
|
|
Loading…
Reference in New Issue