Add 404 error handling

This commit is contained in:
Akira Tempaku 2024-04-14 22:57:19 +09:00
parent e84b170a03
commit 79496d5900
2 changed files with 33 additions and 15 deletions

View file

@ -20,7 +20,7 @@ To use ningle-fbr, you must use [package-inferred-system](https://asdf.common-li
`/src/app.lisp`
```lisp
(uiop:define-package #:example
(defpackage #:example
(:nicknames #:example/app)
(:use #:cl)
(:import-from #:ningle)
@ -46,7 +46,7 @@ To use ningle-fbr, you must use [package-inferred-system](https://asdf.common-li
`/src/routes/nested/page.lisp``/nested/page`
```lisp
(uiop:define-package #:example/routes/index
(defpackage #:example/routes/index
(:use #:cl)
(:export #:handle-get
#:handle-post
@ -75,6 +75,20 @@ In the example below, the parameter `id` can be obtained from handler's params.
`/src/routes/user/=id.lisp``/user/:id`
## Not found error
`not-found.lisp` is a special file to handle 404 errors. Implement `handle-not-found` function and export it.
```lisp
(defpackage #:example/routes/not-found
(:use #:cl)
(:export #:handle-not-found))
(in-package #:example/routes/not-found)
(defun handle-not-found ()
...)
```
# License
Licensed under MIT License.