cowboy(3)

NAME

cowboy - HTTP server

DESCRIPTION

The module cowboy provides convenience functions for manipulating Ranch listeners.

EXPORTS
    • cowboy:start_clear(3) - Listen for connections using plain TCP
    • cowboy:start_tls(3) - Listen for connections using TLS
    • cowboy:stop_listener(3) - Stop the given listener
    • cowboy:get_env(3) - Retrieve a listener's environment value
    • cowboy:set_env(3) - Update a listener's environment value

TYPES

  fields()
    fields() :: [Name
               | {Name, Constraints}
               | {Name, Constraints, Default}]

    Name        :: atom()
    Constraints :: Constraint | [Constraint]
    Constraint  :: cowboy_constraints:constraint()
    Default     :: any()

Fields description for match operations.

This type is used in cowboy_router(3) for matching bindings and in the match functions found in cowboy_req(3).

  http_headers()
    http_headers() :: #{binary() => iodata()}

HTTP headers.

  http_status()
    http_status() :: non_neg_integer() | binary()

HTTP response status.

A binary status can be used to set a reason phrase. Note however that HTTP/2 only sends the status code and drops the reason phrase entirely.

  http_version()
    http_version() :: 'HTTP/2' | 'HTTP/1.1' | 'HTTP/1.0'

HTTP version.

Note that semantically, HTTP/1.1 and HTTP/2 are equivalent.

  opts()
    opts() :: map()

Options for the HTTP/1.1, HTTP/2 and Websocket protocols.

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).

SEE ALSO

cowboy(7), ranch(3)