Next
Cowboy User Guide
Table of Contents
I. Rationale
1. The modern Web
1.1. The prehistoric Web
1.2. HTTP/1.1
1.3. REST
1.4. XmlHttpRequest
1.5. Long-polling
1.6. HTML5
1.7. EventSource
1.8. Websocket
1.9. SPDY
1.10. HTTP/2.0
2. Erlang and the Web
2.1. The Web is concurrent
2.2. The Web is soft real time
2.3. The Web is asynchronous
2.4. The Web is omnipresent
2.5. Erlang is the ideal platform for the Web
II. Introduction
3. Introduction
3.1. Prerequisites
3.2. Supported platforms
3.3. Versioning
3.4. Conventions
4. Getting started
4.1. Bootstrap
4.2. Cowboy setup
4.3. Listening for connections
4.4. Handling requests
5. Request overview
5.1. Request/response
5.2. And then?
5.3. Keep-alive (HTTP/1.1)
5.4. Pipelining (HTTP/1.1)
5.5. Asynchronous requests (SPDY)
6. Erlang for beginners
6.1. Learn You Some Erlang for Great Good!
6.2. Programming Erlang
III. Configuration
7. Routing
7.1. Structure
7.2. Match syntax
7.3. Constraints
7.4. Compilation
7.5. Live update
8. Constraints
8.1. Structure
8.2. Built-in constraints
8.3. Custom constraint
9. Static files
9.1. Serve one file
9.2. Serve all files from a directory
9.3. Customize the mimetype detection
9.4. Generate an etag
IV. Request and response
10. Handlers
10.1. Plain HTTP handlers
10.2. Other handlers
10.3. Cleaning up
11. Loop handlers
11.1. Initialization
11.2. Receive loop
11.3. Streaming loop
11.4. Timeout
11.5. Hibernate
12. The Req object
12.1. A special variable
12.2. Overview of the cowboy_req interface
12.3. Request
12.4. Bindings
12.5. Query string
12.6. Request URL
12.7. Headers
12.8. Meta
12.9. Peer
13. Reading the request body
13.1. Check for request body
13.2. Request body length
13.3. Reading the body
13.4. Streaming the body
13.5. Rate of data transmission
13.6. Transfer and content decoding
13.7. Reading a form urlencoded body
14. Sending a response
14.1. Reply
14.2. Chunked reply
14.3. Preset response headers
14.4. Preset response body
14.5. Sending files
15. Using cookies
15.1. Setting cookies
15.2. Reading cookies
16. Multipart requests
16.1. Structure
16.2. Form-data
16.3. Checking the content-type
16.4. Reading a multipart message
16.5. Skipping unwanted parts
V. REST
17. REST principles
17.1. REST architecture
17.2. Resources and resource identifiers
17.3. Resource representations
17.4. Self-descriptive messages
17.5. Hypermedia as the engine of application state
18. REST handlers
18.1. Initialization
18.2. Methods
18.3. Callbacks
18.4. Meta data
18.5. Response headers
19. REST flowcharts
19.1. Start
19.2. OPTIONS method
19.3. Content negotiation
19.4. GET and HEAD methods
19.5. PUT, POST and PATCH methods
19.6. DELETE method
19.7. Conditional requests
20. Designing a resource handler
20.1. The service
20.2. Type of resource handler
20.3. Collection handler
20.4. Single resource handler
20.5. The resource
20.6. Representations
20.7. Redirections
20.8. The request
20.9. OPTIONS method
20.10. GET and HEAD methods
20.11. PUT, POST and PATCH methods
20.12. DELETE methods
VI. Websocket
21. The Websocket protocol
21.1. Description
21.2. Implementation
22. Handling Websocket connections
22.1. Initialization
22.2. Handling frames from the client
22.3. Handling Erlang messages
22.4. Sending frames to the socket
22.5. Ping and timeout
22.6. Hibernate
22.7. Supporting older browsers
VII. Internals
23. Architecture
23.1. One process per connection
23.2. Binaries
23.3. Date header
23.4. Max connections
24. Dealing with broken clients
24.1. Lowercase headers
24.2. Camel-case headers
24.3. Chunked transfer-encoding
25. Middlewares
25.1. Usage
25.2. Configuration
25.3. Routing middleware
25.4. Handler middleware
26. Sub protocols
26.1. Usage
26.2. Upgrade
27. Hooks
27.1. Onresponse