This repository was archived by the owner on Nov 27, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -269,6 +269,13 @@ curl -X POST http://localhost:3000/db/docstore/put -H "Content-Type: application
269269zdpuAkkFaimxyRE2bsiLRSiybkku3oDi4vFHqPZh29BABZtZU
270270```
271271
272+ For the keyvalue store, a JSON object containing the variables ` key ` and
273+ ` value ` must be passed in the POST data:
274+
275+ ``` shell
276+ curl -X POST http://localhost:3001/db/keyvalue/put -H " Content-Type: application/json" -d ' {"key":"Key","value":{ "name": "Value" }}'
277+ ```
278+
272279### POST|PUT /db/: dbname /inc
273280
274281Increments the counter database : dbname by 1.
Original file line number Diff line number Diff line change @@ -66,7 +66,14 @@ class OrbitdbAPI extends Express {
6666 var db_put = asyncMiddleware ( async ( req , res , next ) => {
6767 let db , hash
6868 db = await dbm . get ( req . params . dbname )
69- hash = await db . put ( req . body )
69+
70+ if ( db . type == 'keyvalue' ) {
71+ let params = req . body ;
72+ hash = await db . put ( params . key , params . value )
73+ } else {
74+ hash = await db . put ( req . body )
75+ }
76+
7077 return res . json ( hash )
7178 } ) ;
7279
You can’t perform that action at this time.
0 commit comments