rest_missing_callbacks.erl 502 B

123456789101112131415161718192021
  1. -module(rest_missing_callbacks).
  2. -export([init/3]).
  3. -export([allowed_methods/2]).
  4. -export([content_types_accepted/2]).
  5. -export([content_types_provided/2]).
  6. init(_Transport, _Req, _Opts) ->
  7. {upgrade, protocol, cowboy_rest}.
  8. allowed_methods(Req, State) ->
  9. {[<<"GET">>, <<"PUT">>], Req, State}.
  10. content_types_accepted(Req, State) ->
  11. {[
  12. {<<"application/json">>, put_application_json}
  13. ], Req, State}.
  14. content_types_provided(Req, State) ->
  15. {[
  16. {<<"text/plain">>, get_text_plain}
  17. ], Req, State}.