Add json api handler

This commit is contained in:
Akira Tempaku 2025-05-17 16:37:45 +09:00
commit d508d9ec70
Signed by: paku
GPG key ID: 5B4E8402BCC50607
5 changed files with 46 additions and 20 deletions

12
src/helper.lisp Normal file
View file

@ -0,0 +1,12 @@
(defpackage #:website/helper
(:use #:cl
#:jingle)
(:export #:api-p))
(in-package #:website/helper)
(defun starts-with-p (prefix string)
(let ((pos (search prefix string :start1 0 :end1 (length prefix) :start2 0)))
(and pos (= pos 0))))
(defun api-p ()
(starts-with-p "/api/" (request-uri *request*)))