d0308d089369486aa2ef952a193e7b475ca77e0a — Dimakakos Dimos 3 years ago cc95f84 master
Add: build instructions and main end-point
4 files changed, 29 insertions(+), 4 deletions(-)

M database.lisp
M packages.lisp
M server.lisp
M wikisophy.asd
M database.lisp => database.lisp +0 -1
@@ 66,4 66,3 @@
	 (get-path (get-title-by-id parent)))
	`(,(caar (clsql:select [title] :from [adj_list] :where [= [title] title]))))))


M packages.lisp => packages.lisp +3 -2
@@ 5,7 5,8 @@
(defpackage wikisophy.database
  (:use :cl)
  (:export :insert-path
   :get-path :connect))

(defpackage wikisophy.server
  (:use :cl :wikisophy.database))
  (:use :cl :wikisophy.database)
  (:export :main))

M server.lisp => server.lisp +23 -1
@@ 13,4 13,26 @@ philosophy in json format."
	  (cl-json:encode-json-to-string (get-path query))))))

(defvar *server* (make-instance 'hunchentoot:easy-acceptor :port 4242))
(hunchentoot:start *server*)

(defun init ()
 (hunchentoot:start *server*))

(defun main ()
  (init) ;; our start-app, for example clack:clack-up
  ;; let the webserver run.
  ;; warning: hardcoded "hunchentoot".
  (handler-case (bt:join-thread (find-if (lambda (th)
                                            (search "hunchentoot" (bt:thread-name th)))
    ;; Catch a user's C-c
    (#+sbcl sb-sys:interactive-interrupt
      #+ccl  ccl:interrupt-signal-condition
      #+clisp system::simple-interrupt-condition
      #+ecl ext:interactive-interrupt
      #+allegro excl:interrupt-signal
      () (progn
           (format *error-output* "Aborting.~&")
           (hunchentoot:stop *server*)
    (error (c) (format t "Woops, an unknown error occured:~&~a~&" c))))

M wikisophy.asd => wikisophy.asd +3 -0
@@ 15,6 15,9 @@
  :description "Web application for generating paths to the philosophy
  article in wikipedia."
  :serial t
  :build-operation "program-op"
  :build-pathname "out/wikisophy.run"
  :entry-point "wikisophy.server:main"
  :depends-on (:hunchentoot