You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Thomas Van de Velde <th...@gmail.com> on 2011/10/03 18:58:24 UTC
Accessing Request Parameter in Erlang?
Hi,
In rewriting a Javascript list function to Erlang, I came across the need to
retrieve parameters passed in the HTTP request. In Javascript this is done
with req.query.myparam. Is there an equivalent in Erlang? Also, is there a
place where I can find more documentation?
Thanks!
Thomas
Re: Accessing Request Parameter in Erlang?
Posted by Thomas Van de Velde <th...@gmail.com>.
Found it:
{Query} = couch_util:get_value(<<"query">>,Req, {[]}),
MyParam = couch_util:get_value(<<"my_param">>,Query)
On Mon, Oct 3, 2011 at 12:24 PM, CGS <cg...@gmail.com> wrote:
> Hi,
>
> There are only records of that type (or nested records):
>
> http://www.erlang.org/doc/**reference_manual/records.html<http://www.erlang.org/doc/reference_manual/records.html>
> http://www.erlang.org/doc/**reference_manual/data_types.**html#id72848<http://www.erlang.org/doc/reference_manual/data_types.html#id72848>
>
> and nice to read from:
>
> http://20bits.com/articles/**erlang-an-introduction-to-**records/<http://20bits.com/articles/erlang-an-introduction-to-records/>
>
> Records are more like data structures in JavaScript.
>
> Cheers,
> CGS
>
>
>
>
> On 10/03/2011 06:58 PM, Thomas Van de Velde wrote:
>
>> Hi,
>>
>> In rewriting a Javascript list function to Erlang, I came across the need
>> to
>> retrieve parameters passed in the HTTP request. In Javascript this is done
>> with req.query.myparam. Is there an equivalent in Erlang? Also, is there a
>> place where I can find more documentation?
>>
>> Thanks!
>>
>> Thomas
>>
>>
>
Re: Accessing Request Parameter in Erlang?
Posted by CGS <cg...@gmail.com>.
Hi,
There are only records of that type (or nested records):
http://www.erlang.org/doc/reference_manual/records.html
http://www.erlang.org/doc/reference_manual/data_types.html#id72848
and nice to read from:
http://20bits.com/articles/erlang-an-introduction-to-records/
Records are more like data structures in JavaScript.
Cheers,
CGS
On 10/03/2011 06:58 PM, Thomas Van de Velde wrote:
> Hi,
>
> In rewriting a Javascript list function to Erlang, I came across the need to
> retrieve parameters passed in the HTTP request. In Javascript this is done
> with req.query.myparam. Is there an equivalent in Erlang? Also, is there a
> place where I can find more documentation?
>
> Thanks!
>
> Thomas
>