mirror of
https://codeberg.org/scip/anydb.git
synced 2025-12-17 04:20:59 +01:00
add rest sample
This commit is contained in:
committed by
T.v.Dein
parent
41d9bd6e07
commit
e6f20f5623
15
README.md
15
README.md
@@ -25,6 +25,7 @@ reasons:
|
||||
- filtering using tags
|
||||
- encryption of entries
|
||||
- templates for custom output for maximum flexibility
|
||||
- includes a tiny web server, which serves a restful API
|
||||
|
||||
**anydb** can do all the things you can do with skate:
|
||||
|
||||
@@ -110,6 +111,20 @@ anydb ls -m template -T "{{ .Value }}"
|
||||
eval $(anydb get foo -m template -T "key='{{ .Key }}' value='{{ .Value }}' ts='{{ .Created}}'")
|
||||
echo "$key: $value"
|
||||
|
||||
# run the restful api server
|
||||
anydb serve
|
||||
|
||||
# post a new key
|
||||
curl -X PUT localhost:8787/anydb/v1/ \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{"key":"foo","val":"bar"}'
|
||||
|
||||
# retrieve it
|
||||
curl localhost:8787/anydb/v1/foo
|
||||
|
||||
# list keys
|
||||
curl localhost:8787/anydb/v1/
|
||||
|
||||
# it comes with a manpage builtin
|
||||
anydb man
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user