website/src/response.lisp

21 lines
651 B
Common Lisp
Raw Normal View History

2024-06-15 16:42:44 +09:00
(defpackage #:hp/response
2024-06-01 22:21:15 +09:00
(:use #:cl)
2024-06-15 16:42:44 +09:00
(:import-from #:hsx)
2024-06-01 22:21:15 +09:00
(:local-nicknames (#:jg #:jingle))
(:local-nicknames (#:cfg #:hp/config/env))
(:local-nicknames (#:cmp #:hp/components/*))
(:export #:response
#:partial-response))
2024-06-15 16:42:44 +09:00
(in-package #:hp/response)
2024-06-01 22:21:15 +09:00
(defun response (page &key status metadata)
(jg:with-html-response
(if status (jg:set-response-status status))
2024-06-15 17:05:39 +09:00
(hsx:render-to-string (cmp:document metadata
2024-06-15 16:42:44 +09:00
(cmp:layout page)))))
2024-06-01 22:21:15 +09:00
(defun partial-response (component &key status)
(jg:with-html-response
(if status (jg:set-response-status status))
2024-06-15 16:42:44 +09:00
(hsx:render-to-string component)))