This is a key-value store that uses Sinatra. It provides the
basic operations GET
, SET
, DELETE
and KEYS
.
You can start the application by executing the file app.rb
:
ruby app.rb
Make sure that you have installed the gems sinatra
and json
.
Now, let's get our hands dirty. By using PUT and the URI
http://localhost:4567/key -d "value" we can set a key-value
pair.
E.g. we can set the key ruby
and the value Is awesome
:
curl -X PUT http://localhost:4567/ruby -d "Is awesome"
In order to get a key's value, we can use GET and the URI
http://localhost:4567/key.
E.g. we can get the value of ruby
:
curl http://localhost:4567/ruby
If we want to list all keys currently set we can use GET and the URI http://localhost:4567/\_/keys:
curl http://localhost:4567/_/keys
Last but not least: you can delete a key by using DELETE
and the URI http://localhost:4567/key.
E.g. we can delete the key ruby
:
curl -X DELETE http://localhost:4567/ruby
- Namespaced key-value pairs