mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-16 05:00:24 +00:00
Convert the documentation to Asciidoc
A few small revisions were made, and Erlang.mk has been updated.
This commit is contained in:
parent
b7d666cfc7
commit
4023e7f4e4
55 changed files with 5701 additions and 1889 deletions
56
doc/src/manual/cowboy_router.asciidoc
Normal file
56
doc/src/manual/cowboy_router.asciidoc
Normal file
|
@ -0,0 +1,56 @@
|
|||
= cowboy_router(3)
|
||||
|
||||
== Name
|
||||
|
||||
cowboy_router - router middleware
|
||||
|
||||
== Description
|
||||
|
||||
The `cowboy_router` middleware maps the requested host and
|
||||
path to the handler to be used for processing the request.
|
||||
It uses the dispatch rules compiled from the routes given
|
||||
to the `compile/1` function for this purpose. It adds the
|
||||
handler name and options to the environment as the values
|
||||
`handler` and `handler_opts` respectively.
|
||||
|
||||
=== Environment input
|
||||
|
||||
dispatch = dispatch_rules():: Dispatch table.
|
||||
|
||||
=== Environment output
|
||||
|
||||
handler = module():: Handler module.
|
||||
handler_opts = any():: Handler options.
|
||||
|
||||
== Types
|
||||
|
||||
=== bindings() = [{atom(), binary()}]
|
||||
|
||||
List of bindings found during routing.
|
||||
|
||||
=== dispatch_rules() - opaque to the user
|
||||
|
||||
Rules for dispatching request used by Cowboy.
|
||||
|
||||
=== routes() = [{Host, Paths} | {Host, cowboy:fields(), Paths}]
|
||||
|
||||
With types:
|
||||
|
||||
* Host = Path = '_' | iodata()
|
||||
* Paths = [{Path, Handler, Opts} | {Path, cowboy:fields(), Handler, HandlerOpts}]
|
||||
* Handler = module()
|
||||
* HandlerOpts = any()
|
||||
|
||||
Human readable list of routes mapping hosts and paths to handlers.
|
||||
|
||||
The syntax for routes is defined in the user guide.
|
||||
|
||||
=== tokens() = [binary()]
|
||||
|
||||
List of host_info and path_info tokens found during routing.
|
||||
|
||||
== Exports
|
||||
|
||||
=== compile(routes()) -> dispatch_rules()
|
||||
|
||||
Compile the routes for use by Cowboy.
|
Loading…
Add table
Add a link
Reference in a new issue