Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

consolidate into a single .ex file

  • Loading branch information...
commit d33288a8d377925b330fbc01669436cff189cfde 1 parent ad0ef6c
Carlo Cabanilla authored
30  src/elixir_cowboy.ex
@@ -21,3 +21,33 @@ defmodule :elixir_cowboy do
21 21
 	end
22 22
 end
23 23
 
  24
+defmodule :elixir_cowboy_handler do
  25
+	@behavior :cowboy_http_handler
  26
+
  27
+	def init({_, :http}, req, []) do
  28
+		{:ok, req, :undefined}
  29
+	end
  30
+
  31
+	def handle(req, state) do
  32
+		{:ok, req2} = Erlang.cowboy_http_req.reply(200, [], "Hello world!", req)
  33
+		{:ok, req2, state}
  34
+	end
  35
+
  36
+	def terminate(_, _) do
  37
+		:ok
  38
+	end
  39
+	
  40
+end
  41
+
  42
+defmodule :elixir_cowboy_sup do
  43
+	@behavior :supervisor
  44
+
  45
+	def start_link() do
  46
+		Erlang.supervisor.start_link({:local, :elixir_cowboy_sup}, :elixir_cowboy_sup, [])
  47
+	end
  48
+
  49
+	def init([]) do
  50
+		{:ok, {{:one_for_one, 10, 10}, []}}
  51
+	end
  52
+end
  53
+
17  src/elixir_cowboy_handler.ex
... ...
@@ -1,17 +0,0 @@
1  
-defmodule :elixir_cowboy_handler do
2  
-	@behavior :cowboy_http_handler
3  
-
4  
-	def init({_, :http}, req, []) do
5  
-		{:ok, req, :undefined}
6  
-	end
7  
-
8  
-	def handle(req, state) do
9  
-		{:ok, req2} = Erlang.cowboy_http_req.reply(200, [], "Hello world!", req)
10  
-		{:ok, req2, state}
11  
-	end
12  
-
13  
-	def terminate(_, _) do
14  
-		:ok
15  
-	end
16  
-	
17  
-end
12  src/elixir_cowboy_sup.ex
... ...
@@ -1,12 +0,0 @@
1  
-defmodule :elixir_cowboy_sup do
2  
-	@behavior :supervisor
3  
-
4  
-	def start_link() do
5  
-		Erlang.supervisor.start_link({:local, :elixir_cowboy_sup}, :elixir_cowboy_sup, [])
6  
-	end
7  
-
8  
-	def init([]) do
9  
-		{:ok, {{:one_for_one, 10, 10}, []}}
10  
-	end
11  
-end
12  
-

0 notes on commit d33288a

Please sign in to comment.
Something went wrong with that request. Please try again.