From c0d0c0186cd6e68a19cdebe4aa88c211567fca32 Mon Sep 17 00:00:00 2001 From: Odonax Date: Wed, 29 Apr 2026 21:02:57 +0200 Subject: [PATCH] Initial commit, test website --- go.mod | 3 +++ main.go | 25 +++++++++++++++++++++++++ templates/home.html | 12 ++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 go.mod create mode 100644 main.go create mode 100644 templates/home.html 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 }}

+ +