From ab0d667b3776786461d15112b648aafc3f00280f Mon Sep 17 00:00:00 2001 From: colin Date: Wed, 28 Dec 2022 12:56:20 -0800 Subject: Refactor: to embrace the new dnd.api package more fully The defendpoint* form installs the new endpoint into the default app, which is just hte name of the package. In this case, the GET "/heroes" endpoint is installed into the app called 'dnd.api:dnd.api It is a bit wierd but that's the full name of the app that you'll need to install into your http server instances. I moved *dnd-arena* to the dnd package b/c the site/view app will also be installed there. In addition, the conjure-arena function should also be part of the "top level" dnd package. In the package.lisp file, I reformatted the file a bit for legibility. More importantly, I exported dnd.api and init-db from the dnd.api package. In particular, the second export sends a clear signal that the view/site code will not touch the model at all. --- dnd.lisp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'dnd.lisp') diff --git a/dnd.lisp b/dnd.lisp index a5cb0a4..4933d85 100644 --- a/dnd.lisp +++ b/dnd.lisp @@ -1,3 +1,19 @@ ;;;; 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)) -- cgit v1.2.3