diff options
| author | Jakob L. Kreuze <zerodaysfordays@sdf.org> | 2023-08-05 14:19:57 -0400 |
|---|---|---|
| committer | Jakob L. Kreuze <zerodaysfordays@sdf.org> | 2023-08-05 14:19:57 -0400 |
| commit | 3843093f47e8c8a177f9769d543c6fdc334b5259 (patch) | |
| tree | c34bba2c62b292b3da821cd47a5deaa1db3bd0d5 | |
| parent | fd46852736c377bf8f161fab7a422adee25b9440 (diff) | |
[dynamic] Allow for mapping SSR pages under /apps instead of /api
| -rw-r--r-- | haunt/api.scm | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/haunt/api.scm b/haunt/api.scm index 3ae6748..2b476d7 100644 --- a/haunt/api.scm +++ b/haunt/api.scm @@ -68,15 +68,16 @@ (values->list ((rate-limit-wrap (match (cons (request-method request) endpoint) - (('GET "comment-form" _) get-comment-form) - ('(GET "challenge" "proof-of-work") make-pow-challenge!) - ('(GET "challenge" "captcha") make-captcha-challenge!) - ('(GET "comments") get-comments) - (('POST "comment") put-comment) - (('POST "comment" "react") put-reaction) - (('GET "rsvp" "event-info") get-event-info) - (('POST "rsvp") post-event-rsvp) + (('GET "apps" "comment-form" _) get-comment-form) + ('(GET "api" "challenge" "proof-of-work") make-pow-challenge!) + ('(GET "api" "challenge" "captcha") make-captcha-challenge!) + ('(GET "api" "comments") get-comments) + (('POST "api" "comment") put-comment) + (('POST "api" "comment" "react") put-reaction) + (('GET "apps" "gallery") get-gallery) + (('GET "api" "rsvp" "event-info") get-event-info) + (('POST "api" "rsvp") post-event-rsvp) (_ (lambda (. args) (not-found request))))) request body)))))) @@ -99,9 +100,7 @@ (let* ((path-encoded (uri-path (request-uri request))) (path (split-and-decode-uri-path path-encoded))) (define-values (response resp-body) - (if (string= "api" (first path)) - (handle-api-request request body (drop path 1)) - (not-found request))) + (handle-api-request request body path)) (values (wrap-response response) resp-body))) (format #t "Server started.~%") |