From fc64b011df69eede8e37a36364bfd9cd0acc7ce5 Mon Sep 17 00:00:00 2001 From: Paul Daigle Date: Sun, 8 May 2016 10:04:05 -0400 Subject: [PATCH] Create start task --- lib/loggex.ex | 6 +++++- mix.exs | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/loggex.ex b/lib/loggex.ex index 74a190f..6e5c5a1 100644 --- a/lib/loggex.ex +++ b/lib/loggex.ex @@ -1,5 +1,6 @@ defmodule Loggex do require IEx + use Application use Elixometer use Plug.Router alias Loggex.Repo @@ -11,7 +12,7 @@ defmodule Loggex do plug :match plug :dispatch - def start do + def start _type, _args do Cowboy.http Loggex, [], port: 6438 Repo.start_link end @@ -27,4 +28,7 @@ defmodule Loggex do send_resp(conn, 200, "Request Logged") end + get "/ping" do + send_resp(conn, 200, "pong") + end end diff --git a/mix.exs b/mix.exs index 8acea3d..683ba37 100644 --- a/mix.exs +++ b/mix.exs @@ -16,7 +16,10 @@ defmodule Loggex.Mixfile do # # Type "mix help compile.app" for more information def application do - [applications: [:logger, :cowboy, :plug, :postgrex, :ecto, :httpoison, :elixometer]] + [ + mod: {Loggex, []}, + applications: [:logger, :cowboy, :plug, :postgrex, :ecto, :httpoison, :elixometer] + ] end # Dependencies can be Hex packages: