To try this example, you need GNU make
and git
in your PATH
.
If you don’t have HTTPie installed, use the appropriate cURL commands instead.
To build the example, run the following command:
make
To start the release in the foreground:
./_rel/static-world-example/bin/static-world-example console
Note: The previous command also starts an Erlang console.
To start the app and an LFE shell:
lfe -pa ebin -pa deps/*/ebin -s static-world # make dev
Point your browser at http://localhost:8080.
The example will serve all the files found in the priv
directory. For example:
http :8080/test.txt
HTTP/1.1 200 OK
server: Cowboy
date: Tue, 05 Jan 2016 07:18:51 GMT
content-length: 52
content-type: text/plain
etag: "3621248494"
last-modified: Tue, 05 Jan 2016 06:37:59 GMT
If you read this then the static file server works!