From ee7919667832660ef05939823af5516eb9344e16 Mon Sep 17 00:00:00 2001 From: Grant Shoshin Shangreaux Date: Sat, 7 Jan 2023 09:38:34 -0600 Subject: Revert "Refactor: to embrace the new dnd.api package more fully" This reverts commit ab0d667b3776786461d15112b648aafc3f00280f. --- api.lisp | 2 +- dnd.lisp | 16 ---------------- init.lisp | 6 ++++++ package.lisp | 47 ++++++++++++++++++++++------------------------- 4 files changed, 29 insertions(+), 42 deletions(-) diff --git a/api.lisp b/api.lisp index f43127a..ca60f21 100644 --- a/api.lisp +++ b/api.lisp @@ -13,7 +13,7 @@ (declare (ignore ignore)) t) -(defendpoint* :get "/heroes" () +(defendpoint api :get "/heroes" () (:auth t) "Get a list of heros sorted by renown" (json:to-json diff --git a/dnd.lisp b/dnd.lisp index 4933d85..a5cb0a4 100644 --- a/dnd.lisp +++ b/dnd.lisp @@ -1,19 +1,3 @@ ;;;; dnd.lisp (in-package #:dnd) - - -(defvar *dnd-arena* nil - "The instance of the HTTP server.") - -(defun conjure-arena () - (setf *dnd-arena* (lzb:create-server)) - (lzb:install-app - *dnd-arena* - (lzb:app 'dnd.api:dnd.api)) ; annoying but needed for now - (lzb:start-server *dnd-arena*)) - - -(defun start () - (api:init-db) - (conjure-arena)) diff --git a/init.lisp b/init.lisp index 67e1fb9..c3382aa 100644 --- a/init.lisp +++ b/init.lisp @@ -10,6 +10,12 @@ :directory (merge-pathnames "dnd-store/" (user-homedir-pathname)) :subsystems (list (make-instance 'db:store-object-subsystem))))) +(defvar *dnd-arena* nil + "The instance of the HTTP server.") +(defun conjure-arena () + (setf *dnd-arena* (lzb:create-server)) + (lzb:install-app *dnd-arena* 'api) + (lzb:start-server *dnd-arena*)) diff --git a/package.lisp b/package.lisp index 16473c5..ff06a36 100644 --- a/package.lisp +++ b/package.lisp @@ -1,30 +1,27 @@ ;;;; package.lisp -(defpackage #:dnd.api - (:use #:cl) - (:local-nicknames - (#:db #:bknr.datastore) - (#:idx #:bknr.indices) - (#:lzb #:lazybones) - (#:re #:cl-ppcre) - (#:json #:jonathan)) - (:import-from - #:lazybones - #:defendpoint - #:defendpoint*) - (:import-from - #:derrida - #:with-plist) - (:export - #:dnd.api - #:init-db)) - (defpackage #:dnd (:use #:cl) - (:local-nicknames - (#:lzb #:lazybones) - (#:api #:dnd.api)) - (:export - #:start)) + (:local-nicknames (#:db #:bknr.datastore) + (#:idx #:bknr.indices) + (#:lzb #:lazybones) + (#:re #:cl-ppcre) + (#:json #:jonathan)) + (:import-from #:lazybones + #:defendpoint + #:defendpoint*) + (:import-from #:derrida + #:with-plist)) - ; the app's name +(defpackage #:dnd.api + (:use #:cl) + (:local-nicknames (#:db #:bknr.datastore) + (#:idx #:bknr.indices) + (#:lzb #:lazybones) + (#:re #:cl-ppcre) + (#:json #:jonathan)) + (:import-from #:lazybones + #:defendpoint + #:defendpoint*) + (:import-from #:derrida + #:with-plist)) -- cgit v1.2.3