A simple example of using the LoopBack KV connectors.
Page Contents

loopback-example-kv-connectors

⚠️ This LoopBack 3 example project is no longer maintained. Please refer to LoopBack 4 Examples instead. ⚠️

KeyValue connector examples.

Examples list

Usage

Examples are written in the form of tests. Ensure everything is working correctly by running the tests before using the code as reference.

For example, to try out the KeyValue-memory connector:

git clone https://github.com/strongloop/loopback-example-kv-connectors.git
cd loopback-example-kv-connectors/kv-memory-lb2x/
npm install
npm test

Then review the tests to understand how to use the connector.

Third party connectors

You will need to start the corresponding servers on your local machine using default application ports before running tests.

For example, to try out the Redis KeyValue connector:

git clone https://github.com/strongloop/loopback-example-kv-connectors.git
cd loopback-example-kv-connectors/redis-lb2x/
npm install
redis-server --daemonize yes # starts redis in the background
npm start

Then review the tests accordingly. To stop the Redis background process, find its process id and kill it:

ps aux | grep redis-server
# ...find the process id (ie. 12345)
kill 12345

We intentionally skip over configuration details like setting up data sources and models as these topics are already covered in our tutorials.


More LoopBack examples

Tags: example_app