MCPcopy Create free account
hub / github.com/vercel/examples / handleGetData

Method handleGetData

go/api/internal/handler/handler.go:56–68  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

54}
55
56func (h *Handler) handleGetData(w http.ResponseWriter, r *http.Request) {
57 items := []model.DataItem{
58 {ID: 1, Name: "Sample Item 1", Value: 100},
59 {ID: 2, Name: "Sample Item 2", Value: 200},
60 {ID: 3, Name: "Sample Item 3", Value: 300},
61 }
62
63 writeJSON(w, http.StatusOK, model.DataResponse{
64 Data: items,
65 Total: len(items),
66 Timestamp: time.Now().UTC().Format(time.RFC3339),
67 })
68}
69
70func (h *Handler) handleGetItem(w http.ResponseWriter, r *http.Request) {
71 id := strings.TrimPrefix(r.URL.Path, "/api/items/")

Callers

nothing calls this directly

Calls 1

writeJSONFunction · 0.85

Tested by

no test coverage detected