Start
Table of Contents
Start
Types
Listener = http | https
AppName = atom()
HandlersOrAppName = Handlers | AppName
HostMatch = term()
StaticDir = file:name() | {priv_dir, App :: atom(), Dir :: file:name()}
Option = {nb_acceptors, non_neg_integer()}
| {ip, inet:ip_address()}
| {port, inet:port_number()}
| {cacertfile, file:name_all()}
| {certfile, file:name_all()}
| {keyfile, file:name_all()}
| {static_dir, {HostMatch, StaticDir}}
| {log_handlers, [{module(), any()}]}
Options = [Option]
leptus functions
start_listener/2
Starts leptus' dependencies and a listener of type Listener.
leptus:start_listener(Listener, HandlersOrAppName) -> {ok, pid()}
Note that if you use AppName, Leptus will try to read
AppName/priv/leptus.config file
which should contain
{handlers, Handlers}.
{options, Options}.
start_listener/3
Starts leptus' dependencies and a listener of type Listener.
leptus:start_listener(Listener, Handlers, Options) -> {ok, pid()}
The OTP way
The recommended method for starting an OTP application:
application:start(crypto), application:start(ranch), application:start(cowboy), application:start(leptus).
After that start_listener function should be called to start a listener.