wip: currently rewriting the project as a full stack application tangled.org/kacaii.dev/sigo
gleam
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

:recycle: conditionlly run on localhost or 0.0.0.0

Kacaii c79e7e1b f6d0ef76

+9
+1
src/app.gleam
··· 69 69 // Start all essential processes under a supervision tree 70 70 let assert Ok(_) = 71 71 supervision_tree.start( 72 + ctx:, 72 73 pog_config:, 73 74 wisp_handler:, 74 75 ws_handler:,
+8
src/app/supervision_tree.gleam
··· 1 + import app/web/context 1 2 import gleam/erlang/process 2 3 import gleam/http/request 3 4 import gleam/http/response ··· 11 12 12 13 /// 󰪋 Start the application supervisor 13 14 pub fn start( 15 + ctx ctx: context.Context, 14 16 pog_config pog_config: pog.Config, 15 17 wisp_handler wisp_handler: fn(wisp.Request) -> wisp.Response, 16 18 ws_handler ws_handler: fn(request.Request(mist.Connection)) -> ··· 26 28 } 27 29 } 28 30 31 + let bind_to = case ctx.env { 32 + context.Dev -> "localhost" 33 + context.Production -> "0.0.0.0" 34 + } 35 + 29 36 // Adding Mist to the supervision tree 30 37 let mist_pool_child = 31 38 webserver_handler 32 39 |> mist.new 40 + |> mist.bind(bind_to) 33 41 |> mist.port(8000) 34 42 35 43 // Starting supervision