๐Ÿ‘ฉโ€๐Ÿš’ Firefighters API written in Gleam!
lustre gleam

:truck: redirect to `/login` on startup

kacaii.dev 09209866 a5d44c8a

verified
+8 -18
+1
client/gleam.toml
··· 9 9 rsvp = ">= 1.2.0 and < 2.0.0" 10 10 gleam_http = ">= 4.3.0 and < 5.0.0" 11 11 modem = ">= 2.1.2 and < 3.0.0" 12 + youid = ">= 1.5.1 and < 2.0.0" 12 13 13 14 [dev-dependencies] 14 15 gleeunit = ">= 1.0.0 and < 2.0.0"
+3 -1
client/manifest.toml
··· 39 39 { name = "platform", version = "1.0.0", build_tools = ["gleam"], requirements = [], otp_app = "platform", source = "hex", outer_checksum = "8339420A95AD89AAC0F82F4C3DB8DD401041742D6C3F46132A8739F6AEB75391" }, 40 40 { name = "polly", version = "3.0.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_erlang", "gleam_otp", "gleam_stdlib", "simplifile"], otp_app = "polly", source = "hex", outer_checksum = "35B11497B998618CEE216415A7853C3FED3F0F2148DC86BD8FC86B95D67F6DD8" }, 41 41 { name = "rsvp", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_fetch", "gleam_http", "gleam_httpc", "gleam_javascript", "gleam_json", "gleam_stdlib", "lustre"], otp_app = "rsvp", source = "hex", outer_checksum = "40F9E0E662FF258E10C7041A9591261FE802D56625FB444B91510969644F7722" }, 42 - { name = "shared", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_json", "gleam_stdlib"], source = "local", path = "../shared" }, 42 + { name = "shared", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_json", "gleam_stdlib", "youid"], source = "local", path = "../shared" }, 43 43 { name = "simplifile", version = "2.3.2", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "E049B4DACD4D206D87843BCF4C775A50AE0F50A52031A2FFB40C9ED07D6EC70A" }, 44 44 { name = "snag", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "snag", source = "hex", outer_checksum = "274F41D6C3ECF99F7686FDCE54183333E41D2C1CA5A3A673F9A8B2C7A4401077" }, 45 45 { name = "telemetry", version = "1.3.0", build_tools = ["rebar3"], requirements = [], otp_app = "telemetry", source = "hex", outer_checksum = "7015FC8919DBE63764F4B4B87A95B7C0996BD539E0D499BE6EC9D7F3875B79E6" }, 46 46 { name = "tom", version = "2.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib", "gleam_time"], otp_app = "tom", source = "hex", outer_checksum = "90791DA4AACE637E30081FE77049B8DB850FBC8CACC31515376BCC4E59BE1DD2" }, 47 47 { name = "wisp", version = "2.2.0", build_tools = ["gleam"], requirements = ["directories", "exception", "filepath", "gleam_crypto", "gleam_erlang", "gleam_http", "gleam_json", "gleam_stdlib", "houdini", "logging", "marceau", "mist", "simplifile"], otp_app = "wisp", source = "hex", outer_checksum = "655163D4DE19E3DD4AC75813A991BFD5523CB4FF2FC5F9F58FD6FB39D5D1806D" }, 48 + { name = "youid", version = "1.5.1", build_tools = ["gleam"], requirements = ["gleam_crypto", "gleam_stdlib", "gleam_time"], otp_app = "youid", source = "hex", outer_checksum = "580E909FD704DB16416D5CB080618EDC2DA0F1BE4D21B490C0683335E3FFC5AF" }, 48 49 ] 49 50 50 51 [requirements] ··· 56 57 modem = { version = ">= 2.1.2 and < 3.0.0" } 57 58 rsvp = { version = ">= 1.2.0 and < 2.0.0" } 58 59 shared = { path = "../shared" } 60 + youid = { version = ">= 1.5.1 and < 2.0.0" }
-5
client/src/client.gleam
··· 1 1 import client/login 2 - import client/signup 3 2 import lustre 4 3 import lustre/attribute.{class} as attr 5 4 import lustre/effect ··· 25 24 pub type Msg { 26 25 UserNavigatedTo(route.Route) 27 26 LoginMsg(login.Msg) 28 - SignupMsg(signup.Msg) 29 27 } 30 28 31 29 fn init(props: Model) -> #(Model, effect.Effect(Msg)) { ··· 50 48 51 49 #(model, effect) 52 50 } 53 - 54 - SignupMsg(_msg) -> #(model, effect.none()) 55 51 } 56 52 } 57 53 ··· 59 55 html.div([class("mx-auto bg-white w-dvw h-dvh")], [ 60 56 case model.route { 61 57 route.Login -> login.view(model.login_model) |> element.map(LoginMsg) 62 - route.Signup -> html.text("signup page") 63 58 route.NotFound(uri) -> { 64 59 html.div([], [ 65 60 html.p([], [html.text("not found: " <> uri.path)]),
-7
client/src/client/signup.gleam
··· 1 - pub type Model { 2 - Model 3 - } 4 - 5 - pub type Msg { 6 - Msg 7 - }
+1 -4
client/src/route.gleam
··· 2 2 3 3 pub type Route { 4 4 Login 5 - Signup 6 5 NotFound(uri.Uri) 7 6 } 8 7 9 8 pub fn parse(uri: uri.Uri) -> Route { 10 9 case uri.path_segments(uri.path) { 11 - ["login"] -> Login 12 - ["signup"] -> Signup 13 - 10 + [] | [""] | ["login"] -> Login 14 11 _ -> NotFound(uri) 15 12 } 16 13 }
+1
server/gleam.toml
··· 13 13 gleam_erlang = ">= 1.3.0 and < 2.0.0" 14 14 filepath = ">= 1.1.2 and < 2.0.0" 15 15 lustre = ">= 5.5.2 and < 6.0.0" 16 + youid = ">= 1.5.1 and < 2.0.0" 16 17 17 18 [dev-dependencies] 18 19 gleeunit = ">= 1.0.0 and < 2.0.0"
+2 -1
server/manifest.toml
··· 39 39 { name = "pgo", version = "0.20.0", build_tools = ["rebar3"], requirements = ["backoff", "opentelemetry_api", "pg_types"], otp_app = "pgo", source = "hex", outer_checksum = "2F11E6649CEB38E569EF56B16BE1D04874AE5B11A02867080A2817CE423C683B" }, 40 40 { name = "platform", version = "1.0.0", build_tools = ["gleam"], requirements = [], otp_app = "platform", source = "hex", outer_checksum = "8339420A95AD89AAC0F82F4C3DB8DD401041742D6C3F46132A8739F6AEB75391" }, 41 41 { name = "pog", version = "4.1.0", build_tools = ["gleam"], requirements = ["exception", "gleam_erlang", "gleam_otp", "gleam_stdlib", "gleam_time", "pgo"], otp_app = "pog", source = "hex", outer_checksum = "E4AFBA39A5FAA2E77291836C9683ADE882E65A06AB28CA7D61AE7A3AD61EBBD5" }, 42 - { name = "shared", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_json", "gleam_stdlib"], source = "local", path = "../shared" }, 42 + { name = "shared", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_json", "gleam_stdlib", "youid"], source = "local", path = "../shared" }, 43 43 { name = "simplifile", version = "2.3.2", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "E049B4DACD4D206D87843BCF4C775A50AE0F50A52031A2FFB40C9ED07D6EC70A" }, 44 44 { name = "splitter", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "splitter", source = "hex", outer_checksum = "3DFD6B6C49E61EDAF6F7B27A42054A17CFF6CA2135FF553D0CB61C234D281DD0" }, 45 45 { name = "squirrel", version = "4.6.0", build_tools = ["gleam"], requirements = ["argv", "envoy", "eval", "filepath", "glam", "gleam_community_ansi", "gleam_crypto", "gleam_json", "gleam_regexp", "gleam_stdlib", "gleam_time", "glexer", "justin", "mug", "non_empty_list", "pog", "simplifile", "term_size", "tom", "tote", "youid"], otp_app = "squirrel", source = "hex", outer_checksum = "0ED10A868BDD1A5D4B68D99CD1C72DC3F23C6E36E16D33454C5F0C31BAC9CB1E" }, ··· 64 64 shared = { path = "../shared" } 65 65 squirrel = { version = ">= 4.6.0 and < 5.0.0" } 66 66 wisp = { version = ">= 2.2.0 and < 3.0.0" } 67 + youid = { version = ">= 1.5.1 and < 2.0.0" }