-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.lisp
More file actions
31 lines (23 loc) · 801 Bytes
/
server.lisp
File metadata and controls
31 lines (23 loc) · 801 Bytes
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
31
(load "~/quicklisp/setup.lisp")
(load "clutils/listener.lisp")
(load "reconstruct.lisp")
(load "main.lisp")
(ql:quickload :drakma)
(ql:quickload :yason)
(defun example-handler(req)
(let* ((query_str (tbnl:get-parameter "query"))
(query (yason:parse query_str))
(word_length (gethash "word_length" query))
(words (gethash "words" query))
(result (recostruct word_length words))
(resp ""))
(let ((s (make-string-output-stream)))
(yason:encode result s)
(setf resp (get-output-stream-string s)))
resp))
(defparameter *lstnr* (make-instance 'utils:listener))
(utils:listener-add-handler *lstnr* "/examplepath/" #'example-handler)
(utils:listener-start *lstnr* 8080)
;(pprint (recostruct "aaabbabaaabbbaaabaaabbbaaa"))
;obj
;(setf (gethash "field" obj) value)