Index: http-transportmod.scm ================================================================== --- http-transportmod.scm +++ http-transportmod.scm @@ -123,10 +123,13 @@ ;; Call this to start the actual server ;; (define *db:process-queue-mutex* (make-mutex)) +(define *http-functions* (make-hash-table)) +(define (http-get-function fnkey) + (hash-table-ref/default *http-functions* fnkey (lambda () "nothing here yet"))) (define (http-transport:run hostn) ;; Configurations for server (tcp-buffer-size 2048) (max-connections 2048) @@ -164,24 +167,25 @@ (dat ($ 'dat)) (res #f)) (cond ((equal? (uri-path (request-uri (current-request))) '(/ "api")) - (send-response body: (api:process-request *dbstruct-db* $) ;; the $ is the request vars proc - headers: '((content-type text/plain))) + (send-response ;; the $ is the request vars proc + body: ((http-get-function 'api:process-request) *dbstruct-db* $) + headers: '((content-type text/plain))) (mutex-lock! *heartbeat-mutex*) (set! *db-last-access* (current-seconds)) (mutex-unlock! *heartbeat-mutex*)) ((equal? (uri-path (request-uri (current-request))) '(/ "")) - (send-response body: (http-transport:main-page))) + (send-response body: ((http-get-function 'http-transport:main-page)))) ((equal? (uri-path (request-uri (current-request))) '(/ "json_api")) - (send-response body: (http-transport:main-page))) + (send-response body: (http-get-function '(http-transport:main-page)))) ((equal? (uri-path (request-uri (current-request))) '(/ "runs")) - (send-response body: (http-transport:main-page))) + (send-response body: (http-get-function '(http-transport:main-page)))) ((equal? (uri-path (request-uri (current-request))) '(/ any)) (send-response body: "hey there!\n" headers: '((content-type text/plain)))) ((equal? (uri-path (request-uri (current-request))) @@ -188,19 +192,19 @@ '(/ "hey")) (send-response body: "hey there!\n" headers: '((content-type text/plain)))) ((equal? (uri-path (request-uri (current-request))) '(/ "jquery3.1.0.js")) - (send-response body: (http-transport:show-jquery) + (send-response body: (http-get-function '(http-transport:show-jquery)) headers: '((content-type application/javascript)))) ((equal? (uri-path (request-uri (current-request))) '(/ "test_log")) - (send-response body: (http-transport:html-test-log $) + (send-response body: (http-get-function '(http-transport:html-test-log $) ) headers: '((content-type text/HTML)))) ((equal? (uri-path (request-uri (current-request))) '(/ "dashboard")) - (send-response body: (http-transport:html-dboard $) + (send-response body: (http-get-function '(http-transport:html-dboard $) ) headers: '((content-type text/HTML)))) (else (continue)))))))) (handle-exceptions exn (debug:print 0 *default-log-port* "Failed to create file " start-file ", exn=" exn) Index: servermod.scm ================================================================== --- servermod.scm +++ servermod.scm @@ -36,10 +36,11 @@ chicken.condition chicken.file chicken.process-context chicken.process-context.posix chicken.random + chicken.file.posix system-information (prefix sqlite3 sqlite3:) typed-records regex