website/src/response.lisp
2024-06-15 17:20:45 +09:00

20 lines
651 B
Common Lisp

(defpackage #:hp/response
(:use #:cl)
(:import-from #:hsx)
(:local-nicknames (#:jg #:jingle))
(:local-nicknames (#:cfg #:hp/config/env))
(:local-nicknames (#:cmp #:hp/components/*))
(:export #:response
#:partial-response))
(in-package #:hp/response)
(defun response (page &key status metadata)
(jg:with-html-response
(if status (jg:set-response-status status))
(hsx:render-to-string (cmp:document metadata
(cmp:layout page)))))
(defun partial-response (component &key status)
(jg:with-html-response
(if status (jg:set-response-status status))
(hsx:render-to-string component)))