MCPcopy Create free account
hub / github.com/driangle/taskmd / handleProjects

Function handleProjects

apps/cli/internal/web/handlers.go:32–48  ·  view source on GitHub ↗
(listFn func() ([]ProjectEntry, error))

Source from the content-addressed store, hash-verified

30}
31
32func handleProjects(listFn func() ([]ProjectEntry, error)) http.HandlerFunc {
33 return func(w http.ResponseWriter, _ *http.Request) {
34 if listFn == nil {
35 writeJSON(w, []ProjectEntry{})
36 return
37 }
38 projects, err := listFn()
39 if err != nil {
40 http.Error(w, err.Error(), http.StatusInternalServerError)
41 return
42 }
43 if projects == nil {
44 projects = []ProjectEntry{}
45 }
46 writeJSON(w, projects)
47 }
48}
49
50func handleConfig(cfg Config) http.HandlerFunc {
51 phases := cfg.Phases

Callers 3

registerRoutesMethod · 0.85

Calls 2

writeJSONFunction · 0.85
ErrorMethod · 0.80

Tested by 2