From cb61b8e34942e661a394069302cd39827c92ae33 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Sun, 5 Jan 2025 17:17:52 -0800 Subject: add json route --- api/whois/whois.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'api/whois/whois.go') diff --git a/api/whois/whois.go b/api/whois/whois.go index a30661d..cea7326 100644 --- a/api/whois/whois.go +++ b/api/whois/whois.go @@ -26,3 +26,17 @@ func FetchLatestName(context *types.RequestContext, req *http.Request, resp http return success(context, req, resp) } } + + +func ListUpdates(context *types.RequestContext, req *http.Request, resp http.ResponseWriter) types.ContinuationChain { + return func(success types.Continuation, failure types.Continuation) types.ContinuationChain { + updates, err := database.ListUpdates(context.DBConn, database.ListUpdatesQuery{Limit: 25}) + if err != nil { + log.Printf("err fetching updates %s", err) + resp.WriteHeader(http.StatusInternalServerError) + return failure(context, req, resp) + } + (*context.TemplateData)["Updates"] = updates + return success(context, req, resp) + } +} -- cgit v1.2.3-70-g09d2