[99s-extend] Cowboy, how call my database select function
Thomas Allen
thomas at oinksoft.com
Wed Jan 9 00:12:02 CET 2013
On 1/8/13 4:36 PM, Козлов Вячеслав wrote:
> I hope I could explain clearly.
This was not quite clear to me, but I'll do my best.
> Tell me how can I use this function in a Cowboy, in hendlers.
Well, you'd use it like any other Erlang function. If it's in a handler,
you probably want to use init/3 or handle/2:
handle(Req, State) ->
_EredisScript = eredis_db:get_script("example", "test"),
{ok, Resp} = cowboy_req:reply(200, Req),
{ok, Resp, State}.
See other examples of implementing `cowboy_http_handler' behaviour in
the Cowboy documentation and in the examples included with the library.
Thomas Allen
More information about the Extend
mailing list