Skip to content

Latest commit

 

History

History

static-world

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Static file handler example

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.

Building

To build the example, run the following command:

make

Starting

Release

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.

LFE

To start the app and an LFE shell:

lfe -pa ebin -pa deps/*/ebin -s static-world # make dev

Usage

Point your browser at http://localhost:8080.

The example will serve all the files found in the priv directory. For example:

Example output

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!