summaryrefslogtreecommitdiff
path: root/api.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'api.lisp')
-rw-r--r--api.lisp25
1 files changed, 25 insertions, 0 deletions
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))))