https://github.com/deathbeam/littledb
The littlest key-value database :baby_chick:
https://github.com/deathbeam/littledb
database nodejs nosql
Last synced: about 1 year ago
JSON representation
The littlest key-value database :baby_chick:
- Host: GitHub
- URL: https://github.com/deathbeam/littledb
- Owner: deathbeam
- License: mit
- Created: 2018-07-16T14:48:03.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-01-16T14:10:45.000Z (over 4 years ago)
- Last Synced: 2025-04-04T23:29:44.289Z (about 1 year ago)
- Topics: database, nodejs, nosql
- Language: JavaScript
- Homepage:
- Size: 84 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# littledb [](https://travis-ci.org/deathbeam/littledb)
`littledb` is the littlest key-value database possible based on this
awesome [gist](https://gist.github.com/brandonb927/9587436).
`littledb` consists of simple JavaScript API to `put`/`get` and `ls`
to/from database and simple database server.
To run server, simply install package and run
```bash
littledb 80 # without passing some available port will be chosen
```
or in node.js
```javascript
const port = 80
require('littledb')().listen(port)
```
Then you can simply access it with `curl`:
```sh
# save key
curl -d "key;value" localhost
# save array
curl -d "key;value;value;value" localhost
# show keys
curl -d "ls" localhost
# get value
curl -d "key" localhost
# delete key
curl -d "key;" localhost
```
To create simple client:
```javascript
const path = './db.json' // this is default path, not required to be passed
const db = require('littledb')(path)
db.put('hello', 'world') // => "world"
db.get('hello') // => "world"
db.ls() // => [ "hello" ]
db.put('hello') // => undefined
db.get('hello') // => undefined
```