# `Roadrunner.Plug`
[🔗](https://github.com/arizona-framework/roadrunner_plug/blob/0.1.0/lib/roadrunner/plug.ex#L1)

Run a Plug on [Roadrunner](https://hexdocs.pm/roadrunner).

Add it to a supervision tree with the plug to serve:

    children = [
      {Roadrunner.Plug, plug: MyApp.Router, port: 4000}
    ]

Options:

  * `:plug` - the plug to run, as `Module` or `{Module, opts}`. Its
    `init/1` runs once, when the listener starts.
  * `:port` - the TCP port to listen on (default `4000` for `:http` and
    `4040` for `:https`, as Phoenix's other adapters; `0` lets the system
    pick one, see `port/1`). A string such as `"4000"` is accepted.
  * `:ip` - the local address to bind (default: all interfaces).
  * `:scheme` - `:http` (default) or `:https`.
  * `:name` - the listener's registered name (default derived from the
    plug module).
  * `:roadrunner` - any other `:roadrunner_listener` option, as a map
    (`protocols`, `ws`, `max_clients`, ...). Request bodies are read on
    demand (`body_buffering: :manual`) with no listener-wide size cap, so
    `Plug.Parsers` (or the plug reading the body) sets their limits; set
    `max_content_length` here to cap every request anyway.

With `scheme: :https`, the TLS options are either `:tls` (`:ssl` server
options as given) or Plug's (`:keyfile`, `:certfile`, `:key`, `:cert`,
`:cacertfile`, `:password`, `:cipher_suite`, `:otp_app`, ...), resolved by
`Plug.SSL.configure/1` the way Phoenix's `:https` endpoint config expects.

# `child_spec`

```elixir
@spec child_spec(keyword()) :: Supervisor.child_spec()
```

A child spec that starts the listener under a supervisor.

# `port`

```elixir
@spec port(atom()) :: :inet.port_number()
```

The port the listener named `name` bound.

# `start_link`

```elixir
@spec start_link(keyword()) :: {:ok, pid()} | {:error, term()}
```

Start the listener, linked to the caller.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
