-
Notifications
You must be signed in to change notification settings - Fork 55
/
phoenix.exs
48 lines (36 loc) · 1.02 KB
/
phoenix.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# https://gist.github.com/Gazler/b4e92e9ab7527c7e326f19856f8a974a
Application.put_env(:phoenix, :json_library, Jason)
Application.put_env(:sample, SamplePhoenix.Endpoint,
http: [ip: {127, 0, 0, 1}, port: 5001],
server: true,
secret_key_base: String.duplicate("a", 64)
)
Mix.install([
{:plug_cowboy, "~> 2.5"},
{:jason, "~> 1.0"},
{:phoenix, "~> 1.7.0"}
])
defmodule SamplePhoenix.SampleController do
use Phoenix.Controller
def index(conn, _) do
send_resp(conn, 200, "Hello, World!")
end
end
defmodule Router do
use Phoenix.Router
pipeline :browser do
plug(:accepts, ["html"])
end
scope "/", SamplePhoenix do
pipe_through(:browser)
get("/", SampleController, :index)
# Prevent a horrible error because ErrorView is missing
get("/favicon.ico", SampleController, :index)
end
end
defmodule SamplePhoenix.Endpoint do
use Phoenix.Endpoint, otp_app: :sample
plug(Router)
end
{:ok, _} = Supervisor.start_link([SamplePhoenix.Endpoint], strategy: :one_for_one)
Process.sleep(:infinity)