diff options
-rw-r--r-- | examples/README.md | 5 | ||||
-rw-r--r-- | examples/elixir_hello_world/README.md | 42 | ||||
-rw-r--r-- | examples/elixir_hello_world/lib/elixir_hello_world.ex | 13 | ||||
-rw-r--r-- | examples/elixir_hello_world/lib/elixir_hello_world/supervisor.ex | 12 | ||||
-rw-r--r-- | examples/elixir_hello_world/lib/elixir_hello_world/top_page_handler.ex | 12 | ||||
-rw-r--r-- | examples/elixir_hello_world/mix.exs | 20 | ||||
-rw-r--r-- | examples/elixir_hello_world/test/elixir_hello_world_test.exs | 9 | ||||
-rw-r--r-- | examples/elixir_hello_world/test/test_helper.exs | 1 |
8 files changed, 1 insertions, 113 deletions
diff --git a/examples/README.md b/examples/README.md index 013313a..8b82296 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,4 +1,4 @@ -Cowboy Examples +Cowboy examples =============== * [chunked_hello_world](./chunked_hello_world): @@ -16,9 +16,6 @@ Cowboy Examples * [echo_post](./echo_post): parse and echo a POST parameter - * [elixir_hello_world](./elixir_hello_world): - simplest example application with Elixir - * [error_hook](./error_hook): provide custom error pages diff --git a/examples/elixir_hello_world/README.md b/examples/elixir_hello_world/README.md deleted file mode 100644 index 09fef39..0000000 --- a/examples/elixir_hello_world/README.md +++ /dev/null @@ -1,42 +0,0 @@ -Elixir Hello World -================== - -This is an example of running Cowboy with [Elixir](http://elixir-lang.org). - -You need Elixir installed -([instructions here](http://elixir-lang.org/getting_started/1.html)) -to run this example. After installing Elixir, you should have both -`elixir` and `mix` executables available. - -You also need [rebar](https://github.com/rebar/rebar) in your PATH -to compile dependencies. - -Then type the following command: - -``` -mix deps.get -``` - -The command above will fetch all dependencies and compile them. - -You can then start the Erlang node with the following command: - -``` -mix run --no-halt -``` - -Then point your browser to localhost:8080. - -Example -------- - -``` bash -$ curl -i http://localhost:8080 -HTTP/1.1 200 OK -connection: keep-alive -server: Cowboy -date: Fri, 28 Sep 2012 04:10:25 GMT -content-length: 12 - -Hello world! -``` diff --git a/examples/elixir_hello_world/lib/elixir_hello_world.ex b/examples/elixir_hello_world/lib/elixir_hello_world.ex deleted file mode 100644 index 2da484b..0000000 --- a/examples/elixir_hello_world/lib/elixir_hello_world.ex +++ /dev/null @@ -1,13 +0,0 @@ -defmodule ElixirHelloWorld do - use Application.Behaviour - - def start(_type, _args) do - dispatch = :cowboy_router.compile([ - {:_, [{"/", ElixirHelloWorld.TopPageHandler, []}]} - ]) - {:ok, _} = :cowboy.start_http(:http, 100, - [port: 8080], - [env: [dispatch: dispatch]]) - ElixirHelloWorld.Supervisor.start_link - end -end diff --git a/examples/elixir_hello_world/lib/elixir_hello_world/supervisor.ex b/examples/elixir_hello_world/lib/elixir_hello_world/supervisor.ex deleted file mode 100644 index f9b569f..0000000 --- a/examples/elixir_hello_world/lib/elixir_hello_world/supervisor.ex +++ /dev/null @@ -1,12 +0,0 @@ -defmodule ElixirHelloWorld.Supervisor do - use Supervisor.Behaviour - - def start_link do - :supervisor.start_link(__MODULE__, []) - end - - def init([]) do - children = [] - supervise children, strategy: :one_for_one - end -end diff --git a/examples/elixir_hello_world/lib/elixir_hello_world/top_page_handler.ex b/examples/elixir_hello_world/lib/elixir_hello_world/top_page_handler.ex deleted file mode 100644 index 58e37b4..0000000 --- a/examples/elixir_hello_world/lib/elixir_hello_world/top_page_handler.ex +++ /dev/null @@ -1,12 +0,0 @@ -defmodule ElixirHelloWorld.TopPageHandler do - def init(_transport, req, []) do - {:ok, req, nil} - end - - def handle(req, state) do - {:ok, req} = :cowboy_req.reply(200, [], "Hello world!", req) - {:ok, req, state} - end - - def terminate(_reason, _req, _state), do: :ok -end diff --git a/examples/elixir_hello_world/mix.exs b/examples/elixir_hello_world/mix.exs deleted file mode 100644 index 00297bf..0000000 --- a/examples/elixir_hello_world/mix.exs +++ /dev/null @@ -1,20 +0,0 @@ -defmodule ElixirHelloWorld.Mixfile do - use Mix.Project - - def project do - [ app: :elixir_hello_world, - version: "0.0.1", - deps: deps ] - end - - # Configuration for the OTP application - def application do - [ mod: { ElixirHelloWorld, [] }, - applications: [:cowboy] ] - end - - defp deps do - [ {:ranch, github: "extend/ranch", tag: "0.8.5"}, - {:cowboy, github: "extend/cowboy"} ] - end -end diff --git a/examples/elixir_hello_world/test/elixir_hello_world_test.exs b/examples/elixir_hello_world/test/elixir_hello_world_test.exs deleted file mode 100644 index 2c14d6c..0000000 --- a/examples/elixir_hello_world/test/elixir_hello_world_test.exs +++ /dev/null @@ -1,9 +0,0 @@ -Code.require_file "../test_helper.exs", __FILE__ - -defmodule ElixirHelloWorldTest do - use ExUnit.Case - - test "the truth" do - assert true - end -end diff --git a/examples/elixir_hello_world/test/test_helper.exs b/examples/elixir_hello_world/test/test_helper.exs deleted file mode 100644 index 4b8b246..0000000 --- a/examples/elixir_hello_world/test/test_helper.exs +++ /dev/null @@ -1 +0,0 @@ -ExUnit.start |