27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
-
+
|
(module apimod
(
api:run-server-process
api:start-server
api:dispatch-cmd
api:execute-requests
api:process-request
;; api:process-request
)
(import scheme
chicken.base
chicken.process-context.posix
chicken.string
chicken.time
|
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
|
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
|
-
+
|
;; http-server send-response
;; api:process-request
;; db:*
;;
;; NB// Runs on the server as part of the server loop
;;
(define (api:process-request dbstruct indat) ;; the $ is the request vars proc
#;(define (api:process-request dbstruct indat) ;; the $ is the request vars proc
(let* ((cmd-in (alist-ref 'cmd indat)) ;; ($ 'cmd))
(cmd (if (string? cmd-in)(string->symbol cmd-in) cmd-in))
(params (alist-ref 'params indat))
(key (alist-ref 'key indat)) ;; TODO - add this back
;; (doprint (apply common:low-noise-print 10 params))
)
;; (if doprint (debug:print 0 *default-log-port* "cmd: " cmd " with params: " params ", key: " key))
|