diff options
author | Loïc Hoguin <[email protected]> | 2013-09-07 16:18:51 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2013-09-07 16:18:51 +0200 |
commit | 51ce122858c4dc09f4440269a412a91afb19ebe7 (patch) | |
tree | e68208030764cd08c78573d3871936001538d29c /examples/basic_auth/README.md | |
parent | 335676876b3f23cdc19450bd5eea68105e8fe142 (diff) | |
download | cowboy-51ce122858c4dc09f4440269a412a91afb19ebe7.tar.gz cowboy-51ce122858c4dc09f4440269a412a91afb19ebe7.tar.bz2 cowboy-51ce122858c4dc09f4440269a412a91afb19ebe7.zip |
Convert the basic auth example to a release
Diffstat (limited to 'examples/basic_auth/README.md')
-rw-r--r-- | examples/basic_auth/README.md | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/examples/basic_auth/README.md b/examples/basic_auth/README.md index 38ae9a2..eea6fd9 100644 --- a/examples/basic_auth/README.md +++ b/examples/basic_auth/README.md @@ -1,24 +1,28 @@ -Cowboy Basic Authorization Rest Hello World -=========================================== +Basic authorization example using REST +====================================== -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 +-------------- + +Request with no authentication: -### Get 401 ``` bash $ curl -i http://localhost:8080 HTTP/1.1 401 Unauthorized @@ -26,10 +30,11 @@ connection: keep-alive server: Cowboy date: Sun, 20 Jan 2013 14:10:27 GMT content-length: 0 -www-authenticate: Restricted +www-authenticate: Basic realm="cowboy" ``` -### Get 200 +Request with authentication: + ``` bash $ curl -i -u "Alladin:open sesame" http://localhost:8080 HTTP/1.1 200 OK |