aboutsummaryrefslogtreecommitdiffstats
path: root/examples/rest_hello_world/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'examples/rest_hello_world/README.md')
-rw-r--r--examples/rest_hello_world/README.md48
1 files changed, 26 insertions, 22 deletions
diff --git a/examples/rest_hello_world/README.md b/examples/rest_hello_world/README.md
index 7072e5e..98af501 100644
--- a/examples/rest_hello_world/README.md
+++ b/examples/rest_hello_world/README.md
@@ -1,24 +1,27 @@
-Cowboy Rest Hello World
-=======================
+REST hello world 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/hello_world_example console
```
-Then run any given command or point your browser to the indicated URL.
+Then point your browser at [http://localhost:8080](http://localhost:8080).
-Examples
---------
+Example output
+--------------
-### Get HTML
+Request HTML:
``` bash
$ curl -i http://localhost:8080
@@ -27,8 +30,8 @@ connection: keep-alive
server: Cowboy
date: Fri, 28 Sep 2012 04:15:52 GMT
content-length: 136
-Content-Type: text/html
-Vary: Accept
+content-type: text/html
+vary: Accept
<html>
<head>
@@ -41,7 +44,7 @@ Vary: Accept
</html>
```
-### Get JSON
+Request JSON:
``` bash
$ curl -i -H "Accept: application/json" http://localhost:8080
@@ -50,13 +53,13 @@ connection: keep-alive
server: Cowboy
date: Fri, 28 Sep 2012 04:16:46 GMT
content-length: 24
-Content-Type: application/json
-Vary: Accept
+content-type: application/json
+vary: Accept
{"rest": "Hello World!"}
```
-### Get text
+Request plain text:
``` bash
$ curl -i -H "Accept: text/plain" http://localhost:8080
@@ -65,13 +68,14 @@ connection: keep-alive
server: Cowboy
date: Fri, 28 Sep 2012 04:18:35 GMT
content-length: 25
-Content-Type: text/plain
-Vary: Accept
+content-type: text/plain
+vary: Accept
REST Hello World as text!
```
-### Get a 406
+Request a non acceptable content-type:
+
``` bash
$ curl -i -H "Accept: text/css" http://localhost:8080
HTTP/1.1 406 Not Acceptable