Silas Vedder
2 years ago
5 changed files with 26 additions and 7 deletions
@ -0,0 +1,12 @@ |
|||||||
|
(in-package #:cl-bible.api) |
||||||
|
|
||||||
|
(defvar *server* (make-instance 'h:easy-acceptor :port 4242)) |
||||||
|
|
||||||
|
(defmethod start ((server h:easy-acceptor)) |
||||||
|
(h:start server)) |
||||||
|
|
||||||
|
(h:define-easy-handler (get-reference :uri "/ref") (reference bible) |
||||||
|
(setf (h:content-type*) "text/plain") |
||||||
|
(setf (h:header-out :access-control-allow-origin) "*") |
||||||
|
(let ((bible (d::read-bible-from-tsv (or bible "mng")))) |
||||||
|
(j:to-json (v:to-sexp (s:find-verse bible (s:parse-position reference)))))) |
Loading…
Reference in new issue