MCPcopy Create free account
hub / github.com/abiosoft/mold / handler

Function handler

examples/1_default_layout/main.go:24–38  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

22}
23
24func handler(w http.ResponseWriter, r *http.Request) {
25 var data struct {
26 Name string
27 }
28 if strings.HasPrefix(r.URL.Path, "/hello") {
29 data.Name = r.FormValue("name")
30 if data.Name == "" {
31 data.Name = "friend"
32 }
33 }
34
35 if err := engine.Render(w, "index.html", data); err != nil {
36 log.Println("error during render:", err)
37 }
38}

Callers

nothing calls this directly

Calls 1

RenderMethod · 0.65

Tested by

no test coverage detected