From 9c1d8f97aae6454d86c6efdfde03e17cf7ea61ed Mon Sep 17 00:00:00 2001 From: demo Date: Thu, 7 May 2026 15:36:18 -0400 Subject: feat: implement Config to house template needed by Handler --- internal/types/types.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'internal') diff --git a/internal/types/types.go b/internal/types/types.go index 0800994..3772f1f 100644 --- a/internal/types/types.go +++ b/internal/types/types.go @@ -1,6 +1,7 @@ package types import ( + "html/template" "io" "net/http" ) @@ -16,11 +17,16 @@ type arc struct { Options []option } -type Story map[string]arc +type story map[string]arc -func (s Story) ServeHTTP(w http.ResponseWriter, r *http.Request) { +type Config struct { + Story story + Template *template.Template +} + +func (cfg Config) ServeHTTP(w http.ResponseWriter, r *http.Request) { arc := r.PathValue("arc") - title := s[arc].Title + title := cfg.Story[arc].Title w.Header().Set("Content-Type", "text/plain") io.WriteString(w, title) -- cgit v1.2.3