See also:
loopback-example-connector (remote)
This is a very simple example of using the LoopBack , loopback-connector-remote.
The example has the following structure:
- : A LoopBack application that connects to a backend data source (just the in-memory data source here) and provides a CRUD API (both Node and REST) to interact with the data source.
client
: A Node application that connects to the LoopBack server application using the . This acts as a very simple Node client SDK for LoopBack.common/models
: Model definitions shared between client and server applications. Using a shared model definition ensures that client and server expect the same model structures. This simple example defines onlyone model:Person
, with a single property, .create.js
: A simple example script that creates a new Person record (instance).
How to run the examples
Clone the repo
Initially, you need to run to install all the dependencies for both client and server. Then, start the server application.
Basic CRUD Example
Now in another shell, run an example that uses the client “SDK.”
Now open LoopBack Explorer at . This provides a view into the server application REST API.
In Response Body, you will see the record that create.js
created via the Node client SDK:
Auth Example
This example demonstrates the following basic tasks (using the remote connector):
- Registering a user
- Logging in as a user
- Securing access to custom methodsAfter running the server, you can run the
examples/auth.js
example in a separate shell.
Tags: example_app