diff --git a/qlfile.lock b/qlfile.lock index 7668303..9953060 100644 --- a/qlfile.lock +++ b/qlfile.lock @@ -21,7 +21,7 @@ ("ningle-fbr" . (:class qlot/source/git:source-git :initargs (:remote-url "https://github.com/skyizwhite/ningle-fbr.git") - :version "git-e84b170a03c6cee3a4b2b191469e83251ae9e032")) + :version "git-79496d59002546e800fcf0ac59e176ada74a3fb0")) ("cl-ppcre" . (:class qlot/source/ql:source-ql :initargs (:%version :latest) diff --git a/src/app.lisp b/src/app.lisp index ce84206..5077aa9 100644 --- a/src/app.lisp +++ b/src/app.lisp @@ -3,9 +3,6 @@ (:use #:cl) (:local-nicknames (#:jg #:jingle)) (:local-nicknames (#:fbr #:ningle-fbr)) - (:local-nicknames (#:pi #:piccolo)) - (:local-nicknames (#:view #:hp/view)) - (:local-nicknames (#:cmp #:hp/components/*)) (:local-nicknames (#:mw #:hp/middlewares/*)) (:export #:start #:stop @@ -15,12 +12,6 @@ (defparameter *app* (jg:make-app :address "localhost" :port 3000)) -(defmethod jg:not-found ((app jg:app)) - (view:render (cmp:not-found-page) - :status :not-found - :metadata '(:title "404 Not Found" - :description "お探しのページは見つかりませんでした。"))) - (defun start () (jg:start *app*)) diff --git a/src/components/.keep b/src/components/.keep new file mode 100644 index 0000000..e69de29 diff --git a/src/components/not-found.lisp b/src/components/not-found.lisp deleted file mode 100644 index 15ab9a3..0000000 --- a/src/components/not-found.lisp +++ /dev/null @@ -1,10 +0,0 @@ -(defpackage #:hp/components/not-found - (:use #:cl) - (:local-nicknames (#:pi #:piccolo)) - (:export #:not-found-page)) -(in-package #:hp/components/not-found) - -(pi:define-element not-found-page () - (pi:h - (section - (h1 "404 Not Found")))) diff --git a/src/routes/not-found.lisp b/src/routes/not-found.lisp new file mode 100644 index 0000000..3078a05 --- /dev/null +++ b/src/routes/not-found.lisp @@ -0,0 +1,21 @@ +(defpackage #:hp/routes/not-found + (:use #:cl) + (:local-nicknames (#:jg #:jingle)) + (:local-nicknames (#:pi #:piccolo)) + (:local-nicknames (#:view #:hp/view)) + (:export #:handle-not-found)) +(in-package #:hp/routes/not-found) + +(defparameter *metadata* + '(:title "404 Not Found" + :description "お探しのページは見つかりませんでした。")) + +(pi:define-element page () + (pi:h + (section + (h1 "404 Not Found")))) + +(defun handle-not-found () + (view:render (page) + :status :not-found + :metadata *metadata*))