commit bca3d29c51ade961d19b715d5d06b8cc1aaf38ea
Author: Tyler Clark <tyler.clark@foxide.xyz>
Date: Mon, 1 Sep 2025 22:10:58 -0400
Initial commit
Diffstat:
5 files changed, 50 insertions(+), 0 deletions(-)
diff --git a/README.md b/README.md
@@ -0,0 +1,3 @@
+# HoneyComb Project
+HoneyComb is a project for creating a web interface for interacting with Bhyve VMs and jails on FreeBSD hosts.
+The project utilizes the Go + HTMX stack.
diff --git a/main.go b/main.go
@@ -0,0 +1,32 @@
+package main
+
+import (
+ "fmt"
+ "html/template"
+ "net/http"
+ "os/exec"
+)
+
+func helloHandler(w http.ResponseWriter, r *http.Request) {
+ tmpl := template.Must(template.ParseFiles("static/hello.html"))
+ tmpl.Execute(w, map[string]string{"Name": "HTMX + Go"})
+}
+
+func kernV(w http.ResponseWriter, r *http.Request) {
+ tmpl := template.Must(template.ParseFiles("static/cmd.html"))
+ cmd := exec.Command("free", "-h");
+ output, err := cmd.Output()
+ if err != nil {
+ fmt.Println("Error:", err)
+ return
+ }
+ out := string(output)
+ tmpl.Execute(w, map[string]string{"Output": out})
+}
+
+func main() {
+ http.HandleFunc("/cmd", kernV)
+ http.HandleFunc("/hello", helloHandler)
+ http.Handle("/", http.FileServer(http.Dir("./static")))
+ http.ListenAndServe(":8080", nil)
+}
diff --git a/static/cmd.html b/static/cmd.html
@@ -0,0 +1 @@
+<p>{{ .Output }}</p>
diff --git a/static/hello.html b/static/hello.html
@@ -0,0 +1 @@
+<p>Hello from {{.Name}}!</p>
diff --git a/static/index.html b/static/index.html
@@ -0,0 +1,13 @@
+<!-- static/index.html -->
+<!DOCTYPE html>
+<html>
+<head>
+ <script src="https://unpkg.com/htmx.org@1.9.2"></script>
+</head>
+<body>
+ <h1>HTMX + Go Demo</h1>
+ <button hx-get="/hello" hx-target="#result" hx-swap="innerHTML">Click Me</button>
+ <button hx-get="/cmd" hx-target="#result" hx-swap="innerHTML">Command</button>
+ <div id="result"></div>
+</body>
+</html>