From a5b176aeab1319c9dc8109765c4b09499f7a9fc1 Mon Sep 17 00:00:00 2001 From: Jakob L. Kreuze Date: Mon, 16 May 2022 21:50:22 -0400 Subject: [scheme] Initial gallery API --- dynamic/api.scm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'dynamic/api.scm') diff --git a/dynamic/api.scm b/dynamic/api.scm index b899dc6..22a9856 100644 --- a/dynamic/api.scm +++ b/dynamic/api.scm @@ -14,7 +14,8 @@ ;;; along with this program. If not, see ;;; . -(use-modules (dynamic capabilities rsvp) +(use-modules (dynamic capabilities gallery) + (dynamic capabilities rsvp) (dynamic logging) (srfi srfi-1) (ice-9 match) @@ -32,12 +33,15 @@ (define (handle-api-request request body endpoint) "Route handler for the API server." (let ((method (request-method request)) - (originating-ip (assoc-ref (request-headers request) 'X-Forwarded-For))) - (log-append! 'info (format #f "~a ~a (~a)" method endpoint originating-ip))) + (originating-ip (assoc-ref (request-headers request) 'X-Forwarded-For)) + (args (uri-query (request-uri request)))) + (log-append! 'info (format #f "~a ~a (~a) (~a)" method endpoint args originating-ip))) ((match (cons (request-method request) endpoint) ;; ('(GET "challenge") make-challenge) ;; ('(GET "comments") get-comments) ;; ('(POST "comment") put-comment) + ('(GET "gallery") get-gallery) + ('(GET "gallery" "image") get-image) ('(GET "rsvp" "event-info") get-event-info) ('(POST "rsvp") post-event-rsvp) (_ (lambda (. args) (not-found request)))) -- cgit v1.3