examples/echo_get/src/echo_get_app.erl
raw| 1 | %% Feel free to use, reuse and abuse the code in this file. |
| 2 | |
| 3 | %% @private |
| 4 | -module(echo_get_app). |
| 5 | -behaviour(application). |
| 6 | |
| 7 | %% API. |
| 8 | -export([start/2]). |
| 9 | -export([stop/1]). |
| 10 | |
| 11 | %% API. |
| 12 | |
| 13 | start(_Type, _Args) -> |
| 14 | Dispatch = cowboy_router:compile([ |
| 15 | {'_', [ |
| 16 | {"/", toppage_h, []} |
| 17 | ]} |
| 18 | ]), |
| 19 | {ok, _} = cowboy:start_clear(http, [{port, 8080}], #{ |
| 20 | env => #{dispatch => Dispatch} |
| 21 | }), |
| 22 | echo_get_sup:start_link(). |
| 23 | |
| 24 | stop(_State) -> |
| 25 | ok = cowboy:stop_listener(http). |