rest_hello_h.erl 393 B

12345678910111213141516
  1. %% This module sends a hello world response via a REST handler.
  2. -module(rest_hello_h).
  3. -export([init/2]).
  4. -export([content_types_provided/2]).
  5. -export([get_text_plain/2]).
  6. init(Req, Opts) ->
  7. {cowboy_rest, Req, Opts}.
  8. content_types_provided(Req, State) ->
  9. {[{{<<"text">>, <<"plain">>, []}, get_text_plain}], Req, State}.
  10. get_text_plain(Req, State) ->
  11. {<<"This is REST!">>, Req, State}.