Add basic web serving and html templating

This commit is contained in:
Eli Ribble 2025-11-03 12:38:47 +00:00
parent 18113ea4ee
commit 25039a8f54
No known key found for this signature in database
8 changed files with 190 additions and 2 deletions

17
endpoint.go Normal file
View file

@ -0,0 +1,17 @@
package main
import (
"net/http"
)
func getFavicon(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-type", "image/x-icon")
http.ServeFile(w, r, "static/favicon.ico")
}
func getRoot(w http.ResponseWriter, r *http.Request) {
err := htmlRoot(w, r.URL.Path)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
}