commit c0d0c0186cd6e68a19cdebe4aa88c211567fca32 Author: Odonax Date: Wed Apr 29 21:02:57 2026 +0200 Initial commit, test website diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..cf825ad --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module 192.168.1.180/odonax/filehost-home + +go 1.26.2 diff --git a/main.go b/main.go new file mode 100644 index 0000000..b83ee36 --- /dev/null +++ b/main.go @@ -0,0 +1,25 @@ +package main + +import ( + "html/template" + "log" + "net/http" +) + +func main() { + tmpl, err := template.ParseFiles("templates/home.html") + if err != nil { + log.Fatal("Failed to load template:", err) + } + + http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + data := map[string]string { + "Name": "Filehost at home", + "Description": "This is where you'll own your files and share them freely.", + } + tmpl.Execute(w, data) + }) + + log.Println("Starting filehost on :8080") + log.Fatal(http.ListenAndServe(":8080", nil)) +} diff --git a/templates/home.html b/templates/home.html new file mode 100644 index 0000000..f024145 --- /dev/null +++ b/templates/home.html @@ -0,0 +1,12 @@ + + + + + + {{ .Name }} + + +

{{ .Name }}

+

{{ .Description }}

+ +