24 lines
442 B
Go
24 lines
442 B
Go
package handlers
|
|
|
|
import (
|
|
"html/template"
|
|
"net/http"
|
|
)
|
|
|
|
var roundWords = map[string]string{
|
|
"hamster": "blue",
|
|
"child": "red",
|
|
"wheel": "white",
|
|
"condition": "black",
|
|
"test": "white",
|
|
}
|
|
|
|
func HandlePing(w http.ResponseWriter, r *http.Request) {
|
|
w.Write([]byte("pong"))
|
|
}
|
|
|
|
func HandleHome(w http.ResponseWriter, r *http.Request) {
|
|
tmpl := template.Must(template.ParseFiles("../components/index.html"))
|
|
tmpl.Execute(w, roundWords)
|
|
}
|