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