all repos — litestore @ ebc4da02d762fb5697769eddd9f78fda996cb624

A minimalist nosql document store.

Minor fixes.
h3rald h3rald@h3rald.com
Fri, 22 May 2015 22:58:10 +0200
commit

ebc4da02d762fb5697769eddd9f78fda996cb624

parent

1fdbc0f9c801c519e14da24ba4b91c0f82445323

2 files changed, 78 insertions(+), 6 deletions(-)

jump to
M admin/md/api.mdadmin/md/api.md

@@ -104,10 +104,14 @@

##### Example ``` -curl -i -X OPTIONS http://0.0.0.0:9500/v1/docs -HTTP/1.1 200 OK -Content-Length: 0 -Allow: HEAD,GET,POST,OPTIONS +$ curl -i -X OPTIONS http://127.0.0.1:9500/v1/docs +HTTP/1.1 200 OK +Content-Length: 0 +Access-Control-Allow-Methods: HEAD,GET,OPTIONS,POST +Allow: HEAD,GET,OPTIONS,POST +Access-Control-Allow-Headers: Content-Type +Access-Control-Allow-Origin: * +Server: LiteStore/1.0.0 ``` #### OPTIONS docs/:id

@@ -125,16 +129,84 @@ ```

#### POST docs +``` +$ curl -i -X POST -d 'A document with a randomly-generated ID.' http://127.0.0.1:9500/v1/docs --header "Content-Type:text/plain" +HTTP/1.1 201 Created +Content-Length: 197 +Content-Type: application/json +Access-Control-Allow-Headers: Content-Type +Access-Control-Allow-Origin: * +Server: LiteStore/1.0.0 + +{"id": "555f93e82190e77500000000", "data": "A document with a randomly-generated ID.", "created": "2015-05-22T08:39:04Z", "modified": null, "tags": ["$type:text", "$subtype:plain", "$format:text"]} +``` + #### HEAD docs +``` +$ curl -i -X HEAD http://127.0.0.1:9500/v1/docs +HTTP/1.1 200 OK +Content-Length: 0 +Content-Type: application/json +Access-Control-Allow-Headers: Content-Type +Access-Control-Allow-Origin: * +Server: LiteStore/1.0.0 +``` + #### HEAD docs/:id +``` +$ curl -i -X HEAD http://127.0.0.1:9500/v1/docs/test +HTTP/1.1 200 OK +Content-Length: 0 +Content-Type: application/json +Access-Control-Allow-Headers: Content-Type +Access-Control-Allow-Origin: * +Server: LiteStore/1.0.0 +``` + #### GET docs +``` +... +``` + #### GET docs/:id +``` +$ curl -i http://127.0.0.1:9500/v1/docs/test +HTTP/1.1 200 OK +Content-Length: 24 +Content-Type: text/plain +Access-Control-Allow-Headers: Content-Type +Access-Control-Allow-Origin: * +Server: LiteStore/1.0.0 + +This is a test document. +``` + #### PUT docs/:id +``` +$ curl -i -X PUT -d 'This is a test document.' http://127.0.0.1:9500/v1/docs/test --header "Content-Type:text/plain" +HTTP/1.1 201 Created +Content-Length: 161 +Content-Type: application/json +Access-Control-Allow-Headers: Content-Type +Access-Control-Allow-Origin: * +Server: LiteStore/1.0.0 + +{"id": "test", "data": "This is a test document.", "created": "2015-05-22T08:40:00Z", "modified": null, "tags": ["$type:text", "$subtype:plain", "$format:text"]} +``` + #### PATCH docs/:id -#### DELETE docs/:id+``` +... +``` + +#### DELETE docs/:id + +``` +... +```
M lib/types.nimlib/types.nim

@@ -140,4 +140,4 @@ "Server": LS.appname & "/" & LS.appversion

} proc newQueryOptions*(): QueryOptions = - return QueryOptions(select: @["id", "data", "content_type", "binary", "searchable", "created", "modified"], single: false, limit: 0, offset: 0, orderby: "", tags: "", search: "") + return QueryOptions(select: @["documents.id AS id", "documents.data AS data", "content_type", "binary", "searchable", "created", "modified"], single: false, limit: 0, offset: 0, orderby: "", tags: "", search: "")