The main idea was to provide a simple and tiny CRUD API (<2Kb once gzipped). Basically, you instantiate a database, inserts objects (documents if you're a fan of MongoDB) and store them wherever you want. Then you can retrieve, update and delete documents. Pretty easy.
At first I hard-coded the usage of localStorage, then with the help of Fabrice Weinberg and Valérian Galliat, I managed to externalize the driver (what does the storage) so that you can plug the CRUD class to whatever suits your needs.
The driver is what actually stores your data. It is the interface that deals with persistence. To put it simple, the Database class manipulate your data while the driver stores them.
You can code your own driver or use the one I made which relies on DOM Storage (eitherlocalStorage or sessionStorage, depending on how your initialize it). The driver can rely on any storage system that supports key/value pairs (DOM Storage, Redis...). Also, it has to implement the 3 methods: getItem, setItem and removeItem.
Your new post is loading...
https://github.com/HugoGiraudel/CRUD.js