On Friday, February 14, 2014 8:48:48 AM UTC-8, [email protected] wrote:
>
>
>
> Hi everybody,
>
> I have a general problem with coax/hoax to define URI's with query 
> parameters like "http://myurl.com/test?query=param";.
> I found coax and hoax in the Couchbase-Light example PhoneGap APP 
> "TodoLite-PhoneGap".
>
> I definitely need query params, because I want to DELETE couchbase 
> documents or even updating them,
> Therefore the revision is required as query parameter (to name just one 
> scenario).
>

You are almost there. Coax is mostly a URL-path currying API with a little 
bit of knowledge about changes feed etc. So for your use case you want to 
do something like this:

var server = coax("http://server.com";)

// just for example
var database = server("my-database")


database.get(function(error, data){
   // did a get to http://server.com/my-database
})

database.get("foobar", function(error, data){
   // did a get to http://server.com/my-database/foobar
})

// note the array
database.get(["foobar", "baz"], function(error, data){
   // did a get to http://server.com/my-database/foobar/baz
})

// still an array, with query options
database.get(["foobar", "baz", {"x" : "y"}], function(error, data){
   // did a get to http://server.com/my-database/foobar/baz?x=y
})

It looks like the uri and qs parameters you are using are the API to 
mikeal's request library, which hoax uses, but doesn't share the same API.

Hope that helps!

Chris





 

>
> I tested this:
>
> var server = hoax("http://myserver.com/";);
> var options = {
>    uri: 'test',
>    qs: {
>       mykey: 'myvalue'
>    }
> };
>
> var path = server(options);
>
> // should result in --> http://myserver.com/test/123?mykey=myvalue
> path.get("123", function(err, json){
>     console.log("put json", json);
> });
>
> The request is sent, but the query parameter is just ignored.
> Even the official hoax example does not fire query parameters: 
> https://github.com/jchris/hoax
>
> Whats wrong? Any suggestions?
>
> Would be fantastic if Chris Anderson reads this post ;-)
>
> Cheers and thanks,
> Stefan
>

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/9bda69dc-87be-4cb4-b3a9-aab17699d731%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to