Debian Codegraph @

examples/ssl_hello_world/src/ssl_hello_world_app.erl

raw
1 %% Feel free to use, reuse and abuse the code in this file.
2
3 %% @private
4 -module(ssl_hello_world_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 PrivDir = code:priv_dir(ssl_hello_world),
20 {ok, _} = cowboy:start_tls(https, [
21 {port, 8443},
22 {certfile, PrivDir ++ "/ssl/cert.pem"},
23 {keyfile, PrivDir ++ "/ssl/key.pem"}
24 ], #{env => #{dispatch => Dispatch}}),
25 ssl_hello_world_sup:start_link().
26
27 stop(_State) ->
28 ok = cowboy:stop_listener(https).