You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.6 KiB
Markdown

# About
14 years ago
14 years ago
A very simple prototype providing an HTTP interface to Redis. It uses [hiredis](https://github.com/antirez/hiredis) and [jansson](https://github.com/akheron/jansson).
14 years ago
<pre>
make clean all
14 years ago
./turnip &
14 years ago
curl http://127.0.0.1:7379/SET/hello/world
curl http://127.0.0.1:7379/GET/hello
→ “world”
14 years ago
14 years ago
curl -d "GET/hello" http://127.0.0.1:7379/
14 years ago
→ “world”
14 years ago
</pre>
# Ideas
14 years ago
* Add meta-data info per key (MIME type in a second key, for instance).
* Find a way to format multi-bulk data without JSON.
* Support PUT, DELETE, HEAD?
14 years ago
* Add JSONP callbacks.
* Add logging.
* Add support for Redis UNIX socket.
* Enrich config file:
* Provide timeout (this needs to be added to hiredis first.)
* Restrict commands by IP range
14 years ago
* Send your ideas using the github tracker or on twitter [@yowgi](http://twitter.com/yowgi).
# HTTP error codes that could be used (although that's not the case at the moment)
* Missing key: 404 Not Found
* Timeout on the redis side: 503 Service Unavailable
* Unknown verb: 405 Method Not Allowed
# JSON output
14 years ago
The URI `/COMMAND/arg0/arg1/.../argN` returns a JSON object with the command as a key and the result as a value.
14 years ago
**Examples:**
<pre>
// string
$ curl http://127.0.0.1:7379/GET/y
14 years ago
{"GET":"41"}
14 years ago
// number
$ curl http://127.0.0.1:7379/INCR/y
{"INCR":42}
// list
$ curl http://127.0.0.1:7379/LRANGE/x/0/1
{"LRANGE":["abc","def"]}
14 years ago
// status
$ curl http://127.0.0.1:7379/TYPE/y
{"TYPE":[true,"string"]}
// error, which is basically a status
$ curl http://127.0.0.1:7379/MAKE-ME-COFFEE
{"MAKE-ME-COFFEE":[false,"ERR unknown command 'MAKE-ME-COFFEE'"]}
</pre>