View Source Bandit.PhoenixAdapter (Bandit v0.5.1)
A Bandit adapter for Phoenix.
Note that this adapter does not currently support WebSocket connections; it is only suitable for use with HTTP(S)-only Phoenix instances.
To use this adapter, your project will need to include Bandit as a dependency; see
https://hex.pm/bandit for details on the currently supported version of Bandit to include. Once
Bandit is included as a dependency of your Phoenix project, add the following to your endpoint
configuration in config/config.exs
:
config :your_app, YourAppWeb.Endpoint,
adapter: Bandit.PhoenixAdapter
endpoint-configuration
Endpoint configuration
This adapter uses the following endpoint configuration:
:http
: the configuration for the HTTP server. Accepts the following options:port
: The port to run on. Defaults to 4000ip
: The address to bind to. Can be specified as{127, 0, 0, 1}
, or using{:local, path}
to bind to a Unix domain socket. Defaults to {127, 0, 0, 1}.transport_options
: Any valid value fromThousandIsland.Transports.TCP
Defaults to
false
, which will cause Bandit to not start an HTTP server.:https
: the configuration for the HTTPS server. Accepts the following options:port
: The port to run on. Defaults to 4040ip
: The address to bind to. Can be specified as{127, 0, 0, 1}
, or using{:local, path}
to bind to a Unix domain socket. Defaults to {127, 0, 0, 1}.transport_options
: Any valid value fromThousandIsland.Transports.SSL
Defaults to
false
, which will cause Bandit to not start an HTTPS server.