From 79272ef4a0cf6e3f93333f239dd36159202fbbba Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Mon, 26 Dec 2022 15:22:04 -0800 Subject: Add: a basic json endpoint to return hall-of-fame data --- api.lisp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 api.lisp (limited to 'api.lisp') diff --git a/api.lisp b/api.lisp new file mode 100644 index 0000000..8159a1c --- /dev/null +++ b/api.lisp @@ -0,0 +1,25 @@ +;;;; api.lisp -- http routes for dnd + +(in-package :dungeons-and-deadlines) + +(lzb:provision-app (api) + :title "Dungeons & Deadlines" + :version "0.1.0" + :prefix "/api" + :content-type "application/json" + :auth 'default-auth) + +(defun default-auth (&rest ignore) + (declare (ignore ignore)) + t) + + + +(defendpoint* :get "/hall-of-legends" ((filter-by identity)) + (:auth t) + "Get a list of heros sorted by renown" + (json:to-json + (list :heroes + (sort (copy-seq (db:store-objects-with-class 'hero)) + #'> + :key #'renown)))) -- cgit v1.2.3