compiles and runs from iex, but how to run outside that

This commit is contained in:
Joe Ardent 2024-02-17 14:28:47 -08:00
parent 0a8740b4b8
commit 248574eabc
3 changed files with 10 additions and 17 deletions

View File

@ -1,18 +1,12 @@
defmodule Queen do
@moduledoc """
Documentation for `Queen`.
"""
import Plug.Conn
@doc """
Hello world.
def init(opts) do
opts
end
## Examples
iex> Queen.hello()
:world
"""
def hello do
:world
def call(conn, _opts) do
:logger.debug("saying hello")
send_resp(conn, 200, "hello from queen")
end
end

View File

@ -8,6 +8,7 @@ defmodule Queen.Application do
@impl true
def start(_type, _args) do
children = [
{Bandit, plug: Queen}
# Starts a worker by calling: Queen.Worker.start_link(arg)
# {Queen.Worker, arg}
]

View File

@ -14,16 +14,14 @@ defmodule Queen.MixProject do
# Run "mix help compile.app" to learn about applications.
def application do
[
[applications: [:logger, :ecto_sqlite3, :ecto, :bandit, :plug]]
# extra_applications: [:logger]
# extra_applications: [:logger, :ecto_sqlite3, :ecto, :bandit, :plug]
extra_applications: [:logger]
]
end
# Run "mix help deps" to learn about dependencies.
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"},
{:plug, "~> 1.5"},
{:ecto_sqlite3, "~> 0.15"},