summaryrefslogtreecommitdiff
path: root/internal/types/types.go
blob: 0800994e5a3f112648a9175db6c02bebf5b0b37c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package types

import (
	"io"
	"net/http"
)

type option struct {
	Text string
	Arc  string
}

type arc struct {
	Title   string
	Story   []string
	Options []option
}

type Story map[string]arc

func (s Story) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	arc := r.PathValue("arc")
	title := s[arc].Title

	w.Header().Set("Content-Type", "text/plain")
	io.WriteString(w, title)
}