LoopBack / StrongLoop connector for simple local storage

357 views Asked by At

I want to write a Node app for the Raspberry Pi with LoopBack.

It needs to persist some data (LoopBack model objects) locally on the RPi; very little - perhaps 1MB plus some multimedia files. Nothing fancy at all.

I don't want to use a large DB like MongoDB or Redis, or anything with SQL. Just a fast, simple solution that can plug in and be used in the same way as supported DB connectors.

It just needs to store objects on disk with a cache in memory.

Is there built-in to LoopBack a way to do this that I'm missing?

1

There are 1 answers

0
Jodes On

There is a memory connector. And although that is not for storing persistent data, and is not meant for production, it is possible to choose a file to store data as JSON for persistence. That file will maintain the data stored in that memory between application restarts.

Quoting from there:

When the application exits, the memory connector will then store data in the mydata.json file, and when it restarts will load the saved data from that file.