From 88227898edd26a823d0942fc7226adb61a20cb5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 13 Jun 2016 13:23:22 +0200 Subject: Merge static_world and web_server examples The new example is called file_server and it's basically the same as web_server was. The name is clearer than the original, all examples being "Web servers". The new example is also tested and the test suite has been refactored a little. --- examples/static_world/Makefile | 8 ------- examples/static_world/README.asciidoc | 30 ------------------------- examples/static_world/priv/index.html | 1 - examples/static_world/priv/small.mp4 | Bin 383631 -> 0 bytes examples/static_world/priv/small.ogv | Bin 872453 -> 0 bytes examples/static_world/priv/test.txt | 1 - examples/static_world/priv/video.html | 11 --------- examples/static_world/relx.config | 2 -- examples/static_world/src/static_world_app.erl | 27 ---------------------- examples/static_world/src/static_world_sup.erl | 23 ------------------- 10 files changed, 103 deletions(-) delete mode 100644 examples/static_world/Makefile delete mode 100644 examples/static_world/README.asciidoc delete mode 100644 examples/static_world/priv/index.html delete mode 100644 examples/static_world/priv/small.mp4 delete mode 100644 examples/static_world/priv/small.ogv delete mode 100644 examples/static_world/priv/test.txt delete mode 100644 examples/static_world/priv/video.html delete mode 100644 examples/static_world/relx.config delete mode 100644 examples/static_world/src/static_world_app.erl delete mode 100644 examples/static_world/src/static_world_sup.erl (limited to 'examples/static_world') diff --git a/examples/static_world/Makefile b/examples/static_world/Makefile deleted file mode 100644 index cbce76c..0000000 --- a/examples/static_world/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -PROJECT = static_world -PROJECT_DESCRIPTION = Cowboy static file handler example -PROJECT_VERSION = 1 - -DEPS = cowboy -dep_cowboy_commit = master - -include ../../erlang.mk diff --git a/examples/static_world/README.asciidoc b/examples/static_world/README.asciidoc deleted file mode 100644 index 3f09900..0000000 --- a/examples/static_world/README.asciidoc +++ /dev/null @@ -1,30 +0,0 @@ -= Static file handler example - -To try this example, you need GNU `make` and `git` in your PATH. - -To build and run the example, use the following command: - -[source,bash] -$ make run - -The example will serve all the files found in the 'priv/' -directory. For example: - -* http://localhost:8080/test.txt[Plain text file] -* http://localhost:8080/video.html[HTML5 video demo] - -== Example output - -[source,bash] ----- -$ curl -i http://localhost:8080/test.txt -HTTP/1.1 200 OK -connection: keep-alive -server: Cowboy -date: Mon, 09 Sep 2013 13:49:50 GMT -content-length: 52 -content-type: text/plain -last-modified: Fri, 18 Jan 2013 16:33:31 GMT - -If you read this then the static file server works! ----- diff --git a/examples/static_world/priv/index.html b/examples/static_world/priv/index.html deleted file mode 100644 index 2ebe508..0000000 --- a/examples/static_world/priv/index.html +++ /dev/null @@ -1 +0,0 @@ -

Howdy, Pardner

diff --git a/examples/static_world/priv/small.mp4 b/examples/static_world/priv/small.mp4 deleted file mode 100644 index 1fc4788..0000000 Binary files a/examples/static_world/priv/small.mp4 and /dev/null differ diff --git a/examples/static_world/priv/small.ogv b/examples/static_world/priv/small.ogv deleted file mode 100644 index 6409d6e..0000000 Binary files a/examples/static_world/priv/small.ogv and /dev/null differ diff --git a/examples/static_world/priv/test.txt b/examples/static_world/priv/test.txt deleted file mode 100644 index 760cddb..0000000 --- a/examples/static_world/priv/test.txt +++ /dev/null @@ -1 +0,0 @@ -If you read this then the static file server works! diff --git a/examples/static_world/priv/video.html b/examples/static_world/priv/video.html deleted file mode 100644 index eca63ee..0000000 --- a/examples/static_world/priv/video.html +++ /dev/null @@ -1,11 +0,0 @@ - - - -

HTML5 Video Example

- -

Videos taken from TechSlides

- - diff --git a/examples/static_world/relx.config b/examples/static_world/relx.config deleted file mode 100644 index a480902..0000000 --- a/examples/static_world/relx.config +++ /dev/null @@ -1,2 +0,0 @@ -{release, {static_world_example, "1"}, [static_world]}. -{extended_start_script, true}. diff --git a/examples/static_world/src/static_world_app.erl b/examples/static_world/src/static_world_app.erl deleted file mode 100644 index 4d194c7..0000000 --- a/examples/static_world/src/static_world_app.erl +++ /dev/null @@ -1,27 +0,0 @@ -%% Feel free to use, reuse and abuse the code in this file. - -%% @private --module(static_world_app). --behaviour(application). - -%% API. --export([start/2]). --export([stop/1]). - -%% API. - -start(_Type, _Args) -> - Dispatch = cowboy_router:compile([ - {'_', [ - {"/", cowboy_static, {priv_file, static_world, "index.html"}}, - {"/[...]", cowboy_static, {priv_dir, static_world, "", - [{mimetypes, cow_mimetypes, all}]}} - ]} - ]), - {ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [ - {env, [{dispatch, Dispatch}]} - ]), - static_world_sup:start_link(). - -stop(_State) -> - ok. diff --git a/examples/static_world/src/static_world_sup.erl b/examples/static_world/src/static_world_sup.erl deleted file mode 100644 index a57d07a..0000000 --- a/examples/static_world/src/static_world_sup.erl +++ /dev/null @@ -1,23 +0,0 @@ -%% Feel free to use, reuse and abuse the code in this file. - -%% @private --module(static_world_sup). --behaviour(supervisor). - -%% API. --export([start_link/0]). - -%% supervisor. --export([init/1]). - -%% API. - --spec start_link() -> {ok, pid()}. -start_link() -> - supervisor:start_link({local, ?MODULE}, ?MODULE, []). - -%% supervisor. - -init([]) -> - Procs = [], - {ok, {{one_for_one, 10, 10}, Procs}}. -- cgit v1.2.3