diff options
author | Loïc Hoguin <[email protected]> | 2013-09-08 19:50:31 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2013-09-08 19:50:31 +0200 |
commit | 7a7e144a0d79767f726ca9988a7b8fc752f998ae (patch) | |
tree | ae98a1cd8825841b6b4b134d0e7cf9fdc2945270 /examples/rest_stream_response/README.md | |
parent | 630a8055412bb9622ca202ffb7008d418df78d5c (diff) | |
download | cowboy-7a7e144a0d79767f726ca9988a7b8fc752f998ae.tar.gz cowboy-7a7e144a0d79767f726ca9988a7b8fc752f998ae.tar.bz2 cowboy-7a7e144a0d79767f726ca9988a7b8fc752f998ae.zip |
Convert the REST streaming example to a release
Diffstat (limited to 'examples/rest_stream_response/README.md')
-rw-r--r-- | examples/rest_stream_response/README.md | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/examples/rest_stream_response/README.md b/examples/rest_stream_response/README.md index 70e1ba7..90004e6 100644 --- a/examples/rest_stream_response/README.md +++ b/examples/rest_stream_response/README.md @@ -1,26 +1,34 @@ -Cowboy REST Streaming Responses -=============================== +REST streaming example +====================== -To compile this example you need rebar in your PATH. +To try this example, you need GNU `make`, `git` and +[relx](https://github.com/erlware/relx) in your PATH. -Type the following command: -``` -$ rebar get-deps compile -``` +To build the example, run the following command: -You can then start the Erlang node with the following command: +``` bash +$ make ``` -./start.sh + +To start the release in the foreground: + +``` bash +$ ./_rel/bin/rest_stream_response_example console ``` +Then point your browser at [http://localhost:8080](http://localhost:8080). + +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. -Examples --------- +Example output +-------------- -### Get records with a field 2 value of 1 +Fetch records with the second field with value 1: ``` bash $ curl -i localhost:8080 @@ -37,7 +45,7 @@ DAYEFxER,1,18 ... ``` -### Get records with a field 2 value of 4 +Fetch records with the second field with value 4: ``` bash $ curl -i localhost:8080/4 @@ -54,7 +62,7 @@ CA8BBhYD,4,10 ... ``` -### Get a 404 +Fail to use a proper integer and get an error: ``` bash $ curl -i localhost:8080/foo @@ -63,4 +71,5 @@ connection: keep-alive server: Cowboy date: Sun, 10 Feb 2013 19:36:16 GMT content-length: 0 + ``` |