From 3805296d3238b37a4566be14b740ed9d3cf65f77 Mon Sep 17 00:00:00 2001 From: erius Date: Thu, 20 Jun 2024 16:47:04 +0300 Subject: [PATCH] First commit --- .air.toml | 8 ++++++++ .gitignore | 2 ++ go.mod | 5 +++++ go.sum | 2 ++ hello.templ | 5 +++++ main.go | 15 +++++++++++++++ 6 files changed, 37 insertions(+) create mode 100644 .air.toml create mode 100644 .gitignore create mode 100644 go.mod create mode 100644 go.sum create mode 100644 hello.templ create mode 100644 main.go diff --git a/.air.toml b/.air.toml new file mode 100644 index 0000000..36a949b --- /dev/null +++ b/.air.toml @@ -0,0 +1,8 @@ +root = "." +tmp_dir = "tmp" + +[build] +bin = "tmp/main" +cmd = "templ generate && go build -o tmp/main ." +include_ext = ["go", "templ", "html"] +exclude_regex = [".*_templ.go"] diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1f66f9b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +tmp/ +*_templ.go diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..0c7d689 --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module erius.ru/passwd-mgr + +go 1.22.4 + +require github.com/a-h/templ v0.2.707 // indirect diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..ce5d368 --- /dev/null +++ b/go.sum @@ -0,0 +1,2 @@ +github.com/a-h/templ v0.2.707 h1:T1Gkd2ugbRglZ9rYw/VBchWOSZVKmetDbBkm4YubM7U= +github.com/a-h/templ v0.2.707/go.mod h1:5cqsugkq9IerRNucNsI4DEamdHPsoGMQy99DzydLhM8= diff --git a/hello.templ b/hello.templ new file mode 100644 index 0000000..6f1786f --- /dev/null +++ b/hello.templ @@ -0,0 +1,5 @@ +package main + +templ hello(name string) { +
Hello, { name }
+} diff --git a/main.go b/main.go new file mode 100644 index 0000000..3e0431b --- /dev/null +++ b/main.go @@ -0,0 +1,15 @@ +package main + +import ( + "fmt" + "net/http" + + "github.com/a-h/templ" +) + +func main() { + component := hello("John") + http.Handle("/", templ.Handler(component)) + fmt.Println("Listening on :3000") + http.ListenAndServe(":3000", nil) +}