···33// date time handling https://hexdocs.pm/birl/index.html
4455// TODO
66+// - hidden fields
67// - list fields
78// - form sets
89// - decoders/toy.decoder
···11+# formz_demo
22+33+[](https://hex.pm/packages/formz_demo)
44+[](https://hexdocs.pm/formz_demo/)
55+66+```sh
77+gleam add formz_demo@1
88+```
99+```gleam
1010+import formz_demo
1111+1212+pub fn main() {
1313+ // TODO: An example of the project in use
1414+}
1515+```
1616+1717+Further documentation can be found at <https://hexdocs.pm/formz_demo>.
1818+1919+## Development
2020+2121+```sh
2222+gleam run # Run the project
2323+gleam test # Run the tests
2424+```
+28
formz_demo/gleam.toml
···11+name = "formz_demo"
22+version = "1.0.0"
33+44+# Fill out these fields if you intend to generate HTML documentation or publish
55+# your project to the Hex package manager.
66+#
77+# description = ""
88+# licences = ["Apache-2.0"]
99+# repository = { type = "github", user = "", repo = "" }
1010+# links = [{ title = "Website", href = "" }]
1111+#
1212+# For a full reference of all the available options, you can have a look at
1313+# https://gleam.run/writing-gleam/gleam-toml/.
1414+1515+[dependencies]
1616+formz = { path = "../formz" }
1717+formz_lustre = { path = "../formz_lustre" }
1818+formz_nakai = { path = "../formz_nakai" }
1919+gleam_http = ">= 3.7.0 and < 4.0.0"
2020+gleam_erlang = ">= 0.27.0 and < 1.0.0"
2121+gleam_stdlib = ">= 0.34.0 and < 2.0.0"
2222+mist = ">= 3.0.0 and < 4.0.0"
2323+wisp = ">= 1.2.0 and < 2.0.0"
2424+lustre = ">= 4.5.1 and < 5.0.0"
2525+nakai = ">= 1.0.0 and < 2.0.0"
2626+2727+[dev-dependencies]
2828+gleeunit = ">= 1.0.0 and < 2.0.0"
···11+import wisp
22+33+pub type Context {
44+ Context(static_directory: String)
55+}
66+77+pub fn middleware(
88+ req: wisp.Request,
99+ ctx: Context,
1010+ handle_request: fn(wisp.Request) -> wisp.Response,
1111+) -> wisp.Response {
1212+ let req = wisp.method_override(req)
1313+ use <- wisp.log_request(req)
1414+ use <- wisp.rescue_crashes
1515+ use req <- wisp.handle_head(req)
1616+ use <- wisp.serve_static(req, under: "/static", from: ctx.static_directory)
1717+1818+ handle_request(req)
1919+}
+33
formz_demo/src/formz_demo.gleam
···11+import app/router
22+import app/web.{Context}
33+import gleam/erlang/process
44+import mist
55+import wisp
66+import wisp/wisp_mist
77+88+pub fn main() {
99+ wisp.configure_logger()
1010+ let secret_key_base = wisp.random_string(64)
1111+1212+ // A context is constructed holding the static directory path.
1313+ let ctx = Context(static_directory: static_directory())
1414+1515+ let handler = router.handle_request(_, ctx)
1616+1717+ let assert Ok(_) =
1818+ wisp_mist.handler(handler, secret_key_base)
1919+ |> mist.new
2020+ |> mist.port(8000)
2121+ |> mist.start_http
2222+2323+ process.sleep_forever()
2424+}
2525+2626+pub fn static_directory() -> String {
2727+ // The priv directory is where we store non-Gleam and non-Erlang files,
2828+ // including static assets to be served.
2929+ // This function returns an absolute path and works both in development and in
3030+ // production after compilation.
3131+ let assert Ok(priv_directory) = wisp.priv_directory("formz_demo")
3232+ priv_directory <> "/static"
3333+}
···11+# formz_lustre
22+33+[](https://hex.pm/packages/formz_lustre)
44+[](https://hexdocs.pm/formz_lustre/)
55+66+```sh
77+gleam add formz_lustre@1
88+```
99+```gleam
1010+import formz_lustre
1111+1212+pub fn main() {
1313+ // TODO: An example of the project in use
1414+}
1515+```
1616+1717+Further documentation can be found at <https://hexdocs.pm/formz_lustre>.
1818+1919+## Development
2020+2121+```sh
2222+gleam run # Run the project
2323+gleam test # Run the tests
2424+```
+21
formz_lustre/gleam.toml
···11+name = "formz_lustre"
22+version = "1.0.0"
33+44+# Fill out these fields if you intend to generate HTML documentation or publish
55+# your project to the Hex package manager.
66+#
77+# description = ""
88+# licences = ["Apache-2.0"]
99+# repository = { type = "github", user = "", repo = "" }
1010+# links = [{ title = "Website", href = "" }]
1111+#
1212+# For a full reference of all the available options, you can have a look at
1313+# https://gleam.run/writing-gleam/gleam-toml/.
1414+1515+[dependencies]
1616+formz = { path = "../formz" }
1717+gleam_stdlib = ">= 0.34.0 and < 2.0.0"
1818+lustre = ">= 4.5.1 and < 5.0.0"
1919+2020+[dev-dependencies]
2121+gleeunit = ">= 1.0.0 and < 2.0.0"
+20
formz_lustre/manifest.toml
···11+# This file was generated by Gleam
22+# You typically do not need to edit this file
33+44+packages = [
55+ { name = "formz", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "justin"], source = "local", path = "../formz" },
66+ { name = "gleam_erlang", version = "0.27.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "DE468F676D71B313C6C8C5334425CFCF827837333F8AB47B64D8A6D7AA40185D" },
77+ { name = "gleam_json", version = "1.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib", "thoas"], otp_app = "gleam_json", source = "hex", outer_checksum = "9063D14D25406326C0255BDA0021541E797D8A7A12573D849462CAFED459F6EB" },
88+ { name = "gleam_otp", version = "0.12.1", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_stdlib"], otp_app = "gleam_otp", source = "hex", outer_checksum = "BFACC1513410DF5A1617169A9CD7EA334973AC71D860A17574BA7B2EADD89A6F" },
99+ { name = "gleam_stdlib", version = "0.40.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "86606B75A600BBD05E539EB59FABC6E307EEEA7B1E5865AFB6D980A93BCB2181" },
1010+ { name = "gleeunit", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "F7A7228925D3EE7D0813C922E062BFD6D7E9310F0BEE585D3A42F3307E3CFD13" },
1111+ { name = "justin", version = "1.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "justin", source = "hex", outer_checksum = "7FA0C6DB78640C6DC5FBFD59BF3456009F3F8B485BF6825E97E1EB44E9A1E2CD" },
1212+ { name = "lustre", version = "4.5.1", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_json", "gleam_otp", "gleam_stdlib"], otp_app = "lustre", source = "hex", outer_checksum = "B592DA442F6577143CAFA35D4506DB2018DAEED9C707A921E33559E09F001DF1" },
1313+ { name = "thoas", version = "1.2.1", build_tools = ["rebar3"], requirements = [], otp_app = "thoas", source = "hex", outer_checksum = "E38697EDFFD6E91BD12CEA41B155115282630075C2A727E7A6B2947F5408B86A" },
1414+]
1515+1616+[requirements]
1717+formz = { path = "../formz" }
1818+gleam_stdlib = { version = ">= 0.34.0 and < 2.0.0" }
1919+gleeunit = { version = ">= 1.0.0 and < 2.0.0" }
2020+lustre = { version = ">= 4.5.1 and < 5.0.0" }
···11+# formz_nakai
22+33+[](https://hex.pm/packages/formz_nakai)
44+[](https://hexdocs.pm/formz_nakai/)
55+66+```sh
77+gleam add formz_nakai@1
88+```
99+```gleam
1010+import formz_nakai
1111+1212+pub fn main() {
1313+ // TODO: An example of the project in use
1414+}
1515+```
1616+1717+Further documentation can be found at <https://hexdocs.pm/formz_nakai>.
1818+1919+## Development
2020+2121+```sh
2222+gleam run # Run the project
2323+gleam test # Run the tests
2424+```
+21
formz_nakai/gleam.toml
···11+name = "formz_nakai"
22+version = "1.0.0"
33+44+# Fill out these fields if you intend to generate HTML documentation or publish
55+# your project to the Hex package manager.
66+#
77+# description = ""
88+# licences = ["Apache-2.0"]
99+# repository = { type = "github", user = "", repo = "" }
1010+# links = [{ title = "Website", href = "" }]
1111+#
1212+# For a full reference of all the available options, you can have a look at
1313+# https://gleam.run/writing-gleam/gleam-toml/.
1414+1515+[dependencies]
1616+formz = { path = "../formz" }
1717+gleam_stdlib = ">= 0.34.0 and < 2.0.0"
1818+nakai = ">= 1.0.0 and < 2.0.0"
1919+2020+[dev-dependencies]
2121+gleeunit = ">= 1.0.0 and < 2.0.0"
+16
formz_nakai/manifest.toml
···11+# This file was generated by Gleam
22+# You typically do not need to edit this file
33+44+packages = [
55+ { name = "formz", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "justin"], source = "local", path = "../formz" },
66+ { name = "gleam_stdlib", version = "0.40.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "86606B75A600BBD05E539EB59FABC6E307EEEA7B1E5865AFB6D980A93BCB2181" },
77+ { name = "gleeunit", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "F7A7228925D3EE7D0813C922E062BFD6D7E9310F0BEE585D3A42F3307E3CFD13" },
88+ { name = "justin", version = "1.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "justin", source = "hex", outer_checksum = "7FA0C6DB78640C6DC5FBFD59BF3456009F3F8B485BF6825E97E1EB44E9A1E2CD" },
99+ { name = "nakai", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "nakai", source = "hex", outer_checksum = "FD55B7926640FFD21FCC048D7E21752ED94FD424E1A731DC5C9DFB9928007F08" },
1010+]
1111+1212+[requirements]
1313+formz = { path = "../formz" }
1414+gleam_stdlib = { version = ">= 0.34.0 and < 2.0.0" }
1515+gleeunit = { version = ">= 1.0.0 and < 2.0.0" }
1616+nakai = { version = ">= 1.0.0 and < 2.0.0" }