rest_expires_binary.erl 427 B

123456789101112131415161718
  1. -module(rest_expires_binary).
  2. -export([init/3]).
  3. -export([content_types_provided/2]).
  4. -export([get_text_plain/2]).
  5. -export([expires/2]).
  6. init(_Transport, _Req, _Opts) ->
  7. {upgrade, protocol, cowboy_rest}.
  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}.
  12. expires(Req, State) ->
  13. {<<"0">>, Req, State}.