Skip to content

Commit 6e21384

Browse files
committed
Add startup procedure
1 parent d8daa45 commit 6e21384

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

Diff for: src/supervisor.ex

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
defmodule TicTacToe.Supervisor do
2+
def start() do
3+
config()
4+
5+
children = [
6+
TicTacToe.Endpoint
7+
]
8+
9+
Supervisor.start_link(children, strategy: :one_for_one)
10+
end
11+
12+
defp config() do
13+
Application.put_env(:sample, TicTacToe.Endpoint,
14+
http: [ip: {127, 0, 0, 1}, port: 5001],
15+
server: true,
16+
live_view: [signing_salt: "aaaaaaaa"],
17+
secret_key_base: String.duplicate("a", 64)
18+
)
19+
end
20+
end

Diff for: src/tictactoe.gleam

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import gleam/dict.{type Dict}
2+
import gleam/erlang/process
23
import gleam/list
34
import gleam/option.{type Option, None, Some}
45
import gleam/result.{try_recover as else_try}
56

67
pub fn main() {
7-
start_phoenix()
8-
io.println("Hello from tictactoe!")
9-
}
8+
let assert Ok(_) = supervisor()
9+
observer()
1010

11-
@external(erlang, "Elixir.TicTacToe.Endpoint", "start_endpoint")
12-
fn start_phoenix() -> phoenix
11+
process.sleep_forever()
12+
}
1313

1414
// ----- Supervision Tree ------ //
1515

0 commit comments

Comments
 (0)