Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Webdis: HTTP + JSON API for Redis. Parent comment
Actually that's something i started doing too with Node.Js, an HTTP interface to Redis for my personal use.
At first i did go with a RESTful approach, but you quickly hit the limit of commands available versus the numbers of commands in Redis.
The choice i did was the following:
Read command are accessed through GET this way:
GET http://localhost:8124/get/mykey
200 {"mykey" : "mydata"}
GET http://localhost:8124/hgetall/mykey
200 {"hashKey": {"field1": "value1", "field2": "value2"}}
Write commands are run through PUT or POST :
POST http://localhost:8124/set/key/value
201 {"response": 1}
PUT http://localhost:8124/lpush/myList/1
Delete commands through DELETE.
DELETE http://localhost:8124/del/mykey 200 {"response": 1}
DELETE http://localhost:8124/hdel/myHash/field
I'm pretty happy with the result, there are some commands i'm not sure where to put though(lpop, rpop, multi, ...)
There are no comments on this comment yet.
Actually that's something i started doing too with Node.Js, an HTTP interface to Redis for my personal use.
At first i did go with a RESTful approach, but you quickly hit the limit of commands available versus the numbers of commands in Redis.
The choice i did was the following:
Read command are accessed through GET this way:
GET http://localhost:8124/get/mykey
200 {"mykey" : "mydata"}
GET http://localhost:8124/hgetall/mykey
200 {"hashKey": {"field1": "value1", "field2": "value2"}}
Write commands are run through PUT or POST :
POST http://localhost:8124/set/key/value
201 {"response": 1}
PUT http://localhost:8124/lpush/myList/1
201 {"response": 1}
Delete commands through DELETE.
DELETE http://localhost:8124/del/mykey 200 {"response": 1}
DELETE http://localhost:8124/hdel/myHash/field
I'm pretty happy with the result, there are some commands i'm not sure where to put though(lpop, rpop, multi, ...)