(uiop:define-package #:website/helper
  (:use #:cl)
  (:use-reexport #:hsx
                 #:jingle
                 #:jonathan
                 #:access)
  (: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*)))