A simple example of using the LoopBack KV connectors.Note: This page was generated from the loopback-example-kv-connectors/README.md.

loopback-example-kv-connectors

KeyValue connector examples.

Examples list

Usage

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

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

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

Then review the tests to understand how to use theconnector.

Third party connectors

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

For example, to try out the Redis KeyValue connector:

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

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

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

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


More LoopBack examples

Tags: example_app