compiles and runs from iex, but how to run outside that
This commit is contained in:
parent
0a8740b4b8
commit
248574eabc
3 changed files with 10 additions and 17 deletions
20
lib/queen.ex
20
lib/queen.ex
|
@ -1,18 +1,12 @@
|
||||||
defmodule Queen do
|
defmodule Queen do
|
||||||
@moduledoc """
|
import Plug.Conn
|
||||||
Documentation for `Queen`.
|
|
||||||
"""
|
|
||||||
|
|
||||||
@doc """
|
def init(opts) do
|
||||||
Hello world.
|
opts
|
||||||
|
end
|
||||||
|
|
||||||
## Examples
|
def call(conn, _opts) do
|
||||||
|
:logger.debug("saying hello")
|
||||||
iex> Queen.hello()
|
send_resp(conn, 200, "hello from queen")
|
||||||
:world
|
|
||||||
|
|
||||||
"""
|
|
||||||
def hello do
|
|
||||||
:world
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,6 +8,7 @@ defmodule Queen.Application do
|
||||||
@impl true
|
@impl true
|
||||||
def start(_type, _args) do
|
def start(_type, _args) do
|
||||||
children = [
|
children = [
|
||||||
|
{Bandit, plug: Queen}
|
||||||
# Starts a worker by calling: Queen.Worker.start_link(arg)
|
# Starts a worker by calling: Queen.Worker.start_link(arg)
|
||||||
# {Queen.Worker, arg}
|
# {Queen.Worker, arg}
|
||||||
]
|
]
|
||||||
|
|
6
mix.exs
6
mix.exs
|
@ -14,16 +14,14 @@ defmodule Queen.MixProject do
|
||||||
# Run "mix help compile.app" to learn about applications.
|
# Run "mix help compile.app" to learn about applications.
|
||||||
def application do
|
def application do
|
||||||
[
|
[
|
||||||
[applications: [:logger, :ecto_sqlite3, :ecto, :bandit, :plug]]
|
# extra_applications: [:logger, :ecto_sqlite3, :ecto, :bandit, :plug]
|
||||||
# extra_applications: [:logger]
|
extra_applications: [:logger]
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
# Run "mix help deps" to learn about dependencies.
|
# Run "mix help deps" to learn about dependencies.
|
||||||
defp deps do
|
defp deps do
|
||||||
[
|
[
|
||||||
# {:dep_from_hexpm, "~> 0.3.0"},
|
|
||||||
# {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
|
|
||||||
{:bandit, "~> 1.2"},
|
{:bandit, "~> 1.2"},
|
||||||
{:plug, "~> 1.5"},
|
{:plug, "~> 1.5"},
|
||||||
{:ecto_sqlite3, "~> 0.15"},
|
{:ecto_sqlite3, "~> 0.15"},
|
||||||
|
|
Loading…
Reference in a new issue