summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api.lisp2
-rw-r--r--dnd.lisp16
-rw-r--r--init.lisp6
-rw-r--r--package.lisp47
4 files changed, 42 insertions, 29 deletions
diff --git a/api.lisp b/api.lisp
index ca60f21..f43127a 100644
--- a/api.lisp
+++ b/api.lisp
@@ -13,7 +13,7 @@
(declare (ignore ignore))
t)
-(defendpoint api :get "/heroes" ()
+(defendpoint* :get "/heroes" ()
(:auth t)
"Get a list of heros sorted by renown"
(json:to-json
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))
diff --git a/init.lisp b/init.lisp
index c3382aa..67e1fb9 100644
--- a/init.lisp
+++ b/init.lisp
@@ -10,12 +10,6 @@
: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 ff06a36..16473c5 100644
--- a/package.lisp
+++ b/package.lisp
@@ -1,27 +1,30 @@
;;;; package.lisp
-(defpackage #:dnd
+(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))
+ (: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.api
+(defpackage #:dnd
(: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))
+ (:local-nicknames
+ (#:lzb #:lazybones)
+ (#:api #:dnd.api))
+ (:export
+ #:start))
+
+ ; the app's name