An open API service indexing awesome lists of open source software.

https://github.com/angelhtml/cakebase-document


https://github.com/angelhtml/cakebase-document

Last synced: 5 months ago
JSON representation

Awesome Lists containing this project

README

          







Cakebase

TRAVIS
NPM
GitHub issues
NPM


Cakebase is an asynchronous fast json database that allows you to efficiently and easily edit, search or add objects.
This project has been optimized and improved with some updates for 2 years now. Cakebase is currently only available in Nodejs.


Here are a few [examples](https://github.com/erwinkulasic/Cakebase/tree/master/examples)


### **Getting started**

Use [npm](https://www.npmjs.com/) or [yarn](https://classic.yarnpkg.com/en/) to install cakebase.

```bash
npm i cakebase
```

After the installation you can create a json file and start immediately.


### **Usage**

Now you can import Cakebase to your project.

This is the easiest way to use Cakebase
```javascript
const users = require('cakebase')("./users.json");
```

You can also use Cakebase with multiple json files

```javascript
const table = require('cakebase');

const users = table("./users.json");
const log = table("./log.json");
```


add an object to the json file

```javascript
await users.set({ id: 0, username: "John", email: "test@something.com" });
```


Retrieve for objects in the json file

```javascript
const user = await users.get(obj => obj.username === "John");
```


update objects in the json file

```javascript
await users.update(obj => obj.username === "John", { location: "Mars" });
```

remove objects in the json file

```javascript
await users.remove(obj => obj.location === "earth");
```


Delete all objects in the json file

```javascript
await users.clear();
```


### **Contributing**
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.


### **License**
[MIT](https://github.com/erwinkulasic/Cakebase/blob/master/LICENSE)