rest_expires.erl 546 B

12345678910111213141516171819202122
  1. -module(rest_expires).
  2. -export([init/3]).
  3. -export([content_types_provided/2]).
  4. -export([get_text_plain/2]).
  5. -export([expires/2]).
  6. -export([last_modified/2]).
  7. init(_Transport, _Req, _Opts) ->
  8. {upgrade, protocol, cowboy_rest}.
  9. content_types_provided(Req, State) ->
  10. {[{{<<"text">>, <<"plain">>, []}, get_text_plain}], Req, State}.
  11. get_text_plain(Req, State) ->
  12. {<<"This is REST!">>, Req, State}.
  13. expires(Req, State) ->
  14. {{{2012, 9, 21}, {22, 36, 14}}, Req, State}.
  15. last_modified(Req, State) ->
  16. {{{2012, 9, 21}, {22, 36, 14}}, Req, State}.