summaryrefslogtreecommitdiff
path: root/internal/types
diff options
context:
space:
mode:
Diffstat (limited to 'internal/types')
-rw-r--r--internal/types/types.go12
1 files changed, 9 insertions, 3 deletions
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)