Initial commit
This commit is contained in:
19
frontend/handler.go
Normal file
19
frontend/handler.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package frontend
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func Home(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "text/html")
|
||||
var tmpl = template.Must(template.ParseFiles("frontend/htmx/home.html"))
|
||||
err := tmpl.Execute(w, struct {
|
||||
Name string
|
||||
}{
|
||||
Name: "Miau",
|
||||
})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
6
frontend/htmx/home.html
Normal file
6
frontend/htmx/home.html
Normal file
@@ -0,0 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<h1>Hallo, {{.Name}}!</h1>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user