Skip to content

Instantly share code, notes, and snippets.

@Kevinpgalligan
Last active July 21, 2020 11:10
Show Gist options
  • Save Kevinpgalligan/3ccd532ee02863e4a5993e13908b7c71 to your computer and use it in GitHub Desktop.
Save Kevinpgalligan/3ccd532ee02863e4a5993e13908b7c71 to your computer and use it in GitHub Desktop.
(defvar *acceptor*)
(defun start-server (&key (doc-root #P"www/"))
(setf *acceptor*
(make-instance
'hunchentoot:easy-acceptor
:port 4242
:document-root doc-root
:error-template-directory (merge-pathnames #P"errors/"
doc-root)))
(hunchentoot:start *acceptor*))
; > (start-server :doc-root "/home/kg/proyectos/botsocial/www/")
; #<HUNCHENTOOT:EASY-ACCEPTOR (host *, port 4242)>
; > (hunchentoot:acceptor-error-template-directory *acceptor*)
; #P"/home/kg/proyectos/botsocial/www/errors/"
; > (uiop:directory-files #P"/home/kg/proyectos/botsocial/www/errors/")
; (#P"/home/kg/proyectos/botsocial/www/errors/404.html")
;;;; Hunchentoot log when I request 127.0.0.1:4242/test
; 127.0.0.1 - [2020-07-21 11:58:32] "GET /test HTTP/1.1" 404 295 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment