net/http (stdlib)
A search endpoint for your extension's interface, using only the standard library.
mux := http.NewServeMux()
mux.HandleFunc("GET /api/apps/hello-notes/search", func(w http.ResponseWriter, r *http.Request) {
res, err := c.Vault().Search(r.Context(), platformsdk.VaultSearchRequest{
Query: r.URL.Query().Get("q"),
Path: "extensions/hello-notes",
Limit: 20,
})
if err != nil {
http.Error(w, "search is unavailable right now", http.StatusServiceUnavailable)
return
}
json.NewEncoder(w).Encode(res.Hits)
})
Full net/http guide →