aboutsummaryrefslogtreecommitdiffstats
path: root/examples/rest_stream_response
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2016-01-14 20:00:50 +0100
committerLoïc Hoguin <[email protected]>2016-01-14 20:00:50 +0100
commit394b4f0bf7f2a4d496ffe69c8e30cff153d69532 (patch)
tree82c3d7634f93596ec42b41050b4130805a359359 /examples/rest_stream_response
parent4023e7f4e429179fd9c2cce4487c33646c6bd327 (diff)
downloadcowboy-394b4f0bf7f2a4d496ffe69c8e30cff153d69532.tar.gz
cowboy-394b4f0bf7f2a4d496ffe69c8e30cff153d69532.tar.bz2
cowboy-394b4f0bf7f2a4d496ffe69c8e30cff153d69532.zip
Simplify example instructions and fix broken examples
Also convert to AsciiDoc while we're at it.
Diffstat (limited to 'examples/rest_stream_response')
-rw-r--r--examples/rest_stream_response/README.asciidoc (renamed from examples/rest_stream_response/README.md)39
1 files changed, 16 insertions, 23 deletions
diff --git a/examples/rest_stream_response/README.md b/examples/rest_stream_response/README.asciidoc
index 3b49451..411c4c4 100644
--- a/examples/rest_stream_response/README.md
+++ b/examples/rest_stream_response/README.asciidoc
@@ -1,35 +1,26 @@
-REST streaming example
-======================
+= REST streaming example
To try this example, you need GNU `make` and `git` in your PATH.
-To build the example, run the following command:
+To build and run the example, use the following command:
-``` bash
-$ make
-```
+[source,bash]
+$ make run
-To start the release in the foreground:
+Then point your browser to http://localhost:8080
-``` bash
-$ ./_rel/rest_stream_response_example/bin/rest_stream_response_example console
-```
-
-Then point your browser at [http://localhost:8080](http://localhost:8080).
-
-About
------
+== About
This example simulates streaming a large amount of data from a data store one
record at a time in CSV format. It also uses a constraint to ensure that the
last segment of the route is an integer.
-Example output
---------------
+== Example output
Fetch records with the second field with value 1:
-``` bash
+[source,bash]
+----
$ curl -i localhost:8080
HTTP/1.1 200 OK
transfer-encoding: identity
@@ -42,11 +33,12 @@ DBUZGQ0C,1,28
BgoQAxMV,1,6
DAYEFxER,1,18
...
-```
+----
Fetch records with the second field with value 4:
-``` bash
+[source,bash]
+----
$ curl -i localhost:8080/4
HTTP/1.1 200 OK
transfer-encoding: identity
@@ -59,11 +51,12 @@ ABcFDxcE,4,42
DgYQCgEE,4,5
CA8BBhYD,4,10
...
-```
+----
Fail to use a proper integer and get an error:
-``` bash
+[source,bash]
+----
$ curl -i localhost:8080/foo
HTTP/1.1 404 Not Found
connection: keep-alive
@@ -71,4 +64,4 @@ server: Cowboy
date: Sun, 10 Feb 2013 19:36:16 GMT
content-length: 0
-```
+----