Debian Codegraph @

doc/src/manual/cowboy.asciidoc

raw
1 = cowboy(3)
2
3 == Name
4
5 cowboy - HTTP server
6
7 == Description
8
9 The module `cowboy` provides convenience functions for
10 manipulating Ranch listeners.
11
12 == Exports
13
14 * link:man:cowboy:start_clear(3)[cowboy:start_clear(3)] - Listen for connections using plain TCP
15 * link:man:cowboy:start_tls(3)[cowboy:start_tls(3)] - Listen for connections using TLS
16 * link:man:cowboy:stop_listener(3)[cowboy:stop_listener(3)] - Stop the given listener
17 * link:man:cowboy:get_env(3)[cowboy:get_env(3)] - Retrieve a listener's environment value
18 * link:man:cowboy:set_env(3)[cowboy:set_env(3)] - Update a listener's environment value
19
20 == Types
21
22 === fields()
23
24 [source,erlang]
25 ----
26 fields() :: [Name
27 | {Name, Constraints}
28 | {Name, Constraints, Default}]
29
30 Name :: atom()
31 Constraints :: Constraint | [Constraint]
32 Constraint :: cowboy_constraints:constraint()
33 Default :: any()
34 ----
35
36 Fields description for match operations.
37
38 This type is used in link:man:cowboy_router(3)[cowboy_router(3)]
39 for matching bindings and in the match functions found in
40 link:man:cowboy_req(3)[cowboy_req(3)].
41
42 === http_headers()
43
44 [source,erlang]
45 ----
46 http_headers() :: #{binary() => iodata()}
47 ----
48
49 HTTP headers.
50
51 === http_status()
52
53 [source,erlang]
54 ----
55 http_status() :: non_neg_integer() | binary()
56 ----
57
58 HTTP response status.
59
60 A binary status can be used to set a reason phrase. Note
61 however that HTTP/2 only sends the status code and drops
62 the reason phrase entirely.
63
64 === http_version()
65
66 [source,erlang]
67 ----
68 http_version() :: 'HTTP/2' | 'HTTP/1.1' | 'HTTP/1.0'
69 ----
70
71 HTTP version.
72
73 Note that semantically, HTTP/1.1 and HTTP/2 are equivalent.
74
75 === opts()
76
77 [source,erlang]
78 ----
79 opts() :: map()
80 ----
81
82 Options for the HTTP/1.1, HTTP/2 and Websocket protocols.
83
84 The protocol options are in a map containing all the options for
85 the different protocols that may be involved when connecting
86 to the listener, including HTTP/1.1 and HTTP/2.
87
88 The HTTP/1.1 options are documented in the
89 link:man:cowboy_http(3)[cowboy_http(3)] manual
90 and the HTTP/2 options in
91 link:man:cowboy_http2(3)[cowboy_http2(3)].
92
93 == See also
94
95 link:man:cowboy(7)[cowboy(7)],
96 link:man:ranch(3)[ranch(3)]