cat-bookmarker/deps/plug_cowboy
Nat 96939b7aee
Clean up repo and update deps
2024-03-10 11:52:04 -07:00
..
lib/plug Clean up repo and update deps 2024-03-10 11:52:04 -07:00
.fetch Clean up repo and update deps 2024-03-10 11:52:04 -07:00
.formatter.exs Clean up repo and update deps 2024-03-10 11:52:04 -07:00
.hex Clean up repo and update deps 2024-03-10 11:52:04 -07:00
CHANGELOG.md Clean up repo and update deps 2024-03-10 11:52:04 -07:00
LICENSE Clean up repo and update deps 2024-03-10 11:52:04 -07:00
README.md Clean up repo and update deps 2024-03-10 11:52:04 -07:00
hex_metadata.config Clean up repo and update deps 2024-03-10 11:52:04 -07:00
mix.exs Clean up repo and update deps 2024-03-10 11:52:04 -07:00

README.md

Plug.Cowboy

Hex.pm Version Build Status

A Plug Adapter for the Erlang Cowboy web server.

Installation

You can use plug_cowboy in your project by adding the dependency:

def deps do
  [
    {:plug_cowboy, "~> 2.0"},
  ]
end

You can then start the adapter with:

Plug.Cowboy.http MyPlug, []

Supervised handlers

The Plug.Cowboy module can be started as part of a supervision tree like so:

defmodule MyApp do
  # See https://hexdocs.pm/elixir/Application.html
  # for more information on OTP Applications
  @moduledoc false

  use Application

  def start(_type, _args) do
    # List all child processes to be supervised
    children = [
      {Plug.Cowboy, scheme: :http, plug: MyApp, port: 4040}
    ]

    # See https://hexdocs.pm/elixir/Supervisor.html
    # for other strategies and supported options
    opts = [strategy: :one_for_one, name: MyApp.Supervisor]
    Supervisor.start_link(children, opts)
  end
end

Contributing

We welcome everyone to contribute to Plug.Cowboy and help us tackle existing issues!

  • Use the issue tracker for bug reports or feature requests.
  • Open a pull request when you are ready to contribute.
  • Do not update the CHANGELOG.md when submitting a pull request.

License

Plug.Cowboy source code is released under Apache License 2.0. Check the LICENSE file for more information.