feat: display colored word cards from map
This commit is contained in:
@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>HTMX + Go Starter</title>
|
<title>Word Colors</title>
|
||||||
<script src="https://unpkg.com/htmx.org@1.9.10"></script>
|
<script src="https://unpkg.com/htmx.org@1.9.10"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
6
go.mod
6
go.mod
@ -1,3 +1,7 @@
|
|||||||
module golias
|
module golias
|
||||||
|
|
||||||
go 1.24.2
|
go 1.21
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/go-chi/chi/v5 v5.0.12
|
||||||
|
)
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
var roundWords map[string]string{
|
var roundWords = map[string]string{
|
||||||
"hamster": "blue",
|
"hamster": "blue",
|
||||||
"child": "red",
|
"child": "red",
|
||||||
"wheel": "white",
|
"wheel": "white",
|
||||||
@ -18,6 +18,6 @@ func HandlePing(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func HandleHome(w http.ResponseWriter, r *http.Request) {
|
func HandleHome(w http.ResponseWriter, r *http.Request) {
|
||||||
tmpl := template.Must(template.ParseFiles("components/index.html"))
|
tmpl := template.Must(template.ParseFiles("../components/index.html"))
|
||||||
tmpl.Execute(w, nil)
|
tmpl.Execute(w, nil)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user