0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-16 05:00:24 +00:00

Convert the web_server example to a release

Temporary mimetypes list here too.
This commit is contained in:
Loïc Hoguin 2013-09-09 16:10:58 +02:00
parent 8bb7c180ff
commit 6a90d00cee
8 changed files with 37 additions and 50 deletions

View file

@ -1,27 +1,20 @@
Cowboy Static File Handler with Index Support
=============================================
Static file handler 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:
``` bash
$ make
```
You can then start the Erlang node with the following command:
```
./start.sh
To start the release in the foreground:
``` bash
$ ./_rel/bin/web_server_example console
```
Cowboy will serve all the files you put in the priv/ directory. You can replace
the filename given in the example URL with the one of a file you added to this
directory to receive that file. A middleware has been added that will re-route
the request to a different handler if the requested path is a directory.
Example
-------
Point your browser to http://localhost:8080 to see the contents of `priv/`. You
can click on a link to see that file. If HTML is not preferred, the contents of
a directory will be listed as a JSON array (e.g. with `curl
http://localhost:8080`).
Then point your browser at [http://localhost:8080](http://localhost:8080)
to browse the contents of the `priv` directory.