diff options
author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2025-01-05 17:17:52 -0800 |
---|---|---|
committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2025-01-05 17:17:52 -0800 |
commit | cb61b8e34942e661a394069302cd39827c92ae33 (patch) | |
tree | b409465796e3d19b2bcbfb686717041ae7661035 /api/whois | |
parent | 604d4981f29470cd3c28692a79831f405db1eef2 (diff) | |
download | whois-cb61b8e34942e661a394069302cd39827c92ae33.tar.gz whois-cb61b8e34942e661a394069302cd39827c92ae33.zip |
add json route
Diffstat (limited to 'api/whois')
-rw-r--r-- | api/whois/whois.go | 14 |
1 files changed, 14 insertions, 0 deletions
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) + } +} |