From 57e6d1f4165134bc91fc7ccfc28c5b0a74824945 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Sun, 8 Sep 2013 11:07:01 +0200 Subject: Convert the POST echo example to a release --- examples/echo_post/README.md | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) (limited to 'examples/echo_post/README.md') diff --git a/examples/echo_post/README.md b/examples/echo_post/README.md index 66b7ee5..2615352 100644 --- a/examples/echo_post/README.md +++ b/examples/echo_post/README.md @@ -1,30 +1,28 @@ -Cowboy POST Echo -================ +POST parameter echo 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: -``` -./start.sh +``` bash +$ make ``` -Then point your browser to the indicated URL. You can change -the GET parameter to check that the handler is echoing properly. +To start the release in the foreground: -Then run the following command, replacing STRING_TO_ECHO by the -string you want to echo. Check the ```curl_post.sh``` file for details. - -``` -./curl_post.sh STRING_TO_ECHO +``` bash +$ ./_rel/bin/echo_post_example console ``` -Example -------- +As this example echoes a POST parameter, it is a little more +complex to test. Some browsers feature tools that allow you +to perform one such request, or you can use the command line +tool `curl` as we will demonstrate. + +Example output +-------------- ``` bash $ curl -i -d echo=echomeplz http://localhost:8080 @@ -33,7 +31,7 @@ connection: keep-alive server: Cowboy date: Fri, 28 Sep 2012 04:12:36 GMT content-length: 9 -Content-Encoding: utf-8 +content-type: text/plain; charset=utf-8 echomeplz ``` -- cgit v1.2.3