feat: add handlers to serve template and styles

This commit is contained in:
Stevan Freeborn
2025-11-15 09:00:06 -06:00
parent b42c63532f
commit 03cbe49a30
10 changed files with 225 additions and 2 deletions
+24
View File
@@ -0,0 +1,24 @@
// Package handlers provides HTTP handlers for the web application.
package handlers
import (
"net/http"
"text/template"
"github.com/StevanFreeborn/links.stevanfreeborn.com/internal/assets"
)
func Index(w http.ResponseWriter, r *http.Request) {
t, err := template.ParseFS(assets.Templates, "templates/index.gohtml")
if err != nil {
http.Error(w, "Unable to load template", http.StatusInternalServerError)
return
}
t.Execute(w, nil)
}
func CSS(w http.ResponseWriter, r *http.Request) {
http.ServeFileFS(w, r, assets.CSS, r.URL.Path)
}