How to create a supervisor for Cowboy

I have seen example of using Plug.Cowboy in Elixir and it is fairly easy to create a simple app:

defmodule Helix.Application do
  use Application
  def start(_type, _args) do
    children = [
      {Plug.Cowboy,
       scheme: :http,
       plug: Hello.Router,
       options: [
         port: 8080,
         compress: true,
       ]}
    ]
  opts = [strategy: :one_for_one, name: Hello.Supervisor]
  Supervisor.start_link(children, opts)
  end
end

How would I start up Cowboy without Plug? Do I need to use this function here?

https://ninenines.eu/docs/en/cowboy/2.6/manual/cowboy.start_clear/

Thanks in advance.

Never used pure cowboy, but from the documentation seems that this function you posted does what you want, don’t forget to pass the ProtocolOps argument:

The protocol options are in a map containing all the options for the different protocols that may be involved when connecting to the listener, including HTTP/1.1 and HTTP/2.
The HTTP/1.1 options are documented in the cowboy_http(3) manual; and the HTTP/2 options in cowboy_http2(3).

Just give it a spin. :slight_smile:

Check out this post,