orbitdb-archive / orbit-db-http-api

A HTTP API Server for the OrbitDB distributed peer-to-peer database
MIT License
37 stars 11 forks source link

Support key/value pairs for keyvalue store. #4

Closed haydenyoung closed 5 years ago

haydenyoung commented 5 years ago

To test:

create a keyvalue store:

curl http://localhost:3000/db/keyvalue --data 'create=true' --data 'type=keyvalue'

write a key/object-value to the store:

curl -X POST http://localhost:3000/db/keyvalue/put -H "Content-Type: application/json" -d '{"key":"mykey","value":"{ name: \"World\" }"}'

It should correctly parse the JSON and store a JS object against the key.

A simple:

console.log(db._index)

should show the full list correctly written to the keyvalue store.