-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtodolist.lisp
30 lines (25 loc) · 908 Bytes
/
todolist.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
;;;; todolist.lisp
(in-package #:todolist)
(defvar *server-connection*)
(defun start-server (&optional (port 8080))
"Start the Hunchentoot connection on PORT."
(format t "SERVER: Starting connection...~%")
(database-connect)
(setf *server-connection* (hunchentoot:start
(make-instance 'hunchentoot:easy-acceptor
:port port)))
(format t "SERVER: Connection started~%"))
(defun stop-server ()
"Kill the Hunchentoot connection."
(format t "SERVER: Stopping connection...~%")
(hunchentoot:stop *server-connection*)
(setf *server-connection* nil)
(database-disconnect)
(format t "SERVER: Connection stopped~%"))
(defun restart-server (&optional (port 8080))
"Restart the Hunchentoot connection on PORT."
(format t "SERVER: Restarting connection~%")
(when *server-connection*
(stop-server))
(start-server port)
(format t "SERVER: Connection restarted~%"))