-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Here is a working example start from [module.ataraxy 0.17]. May I know using :example instead of :my.handler/example is intentional or not?
config.edn
{:duct.module/ataraxy
{[:get "/example" {body :params}] [:example body]}
:duct.router/ataraxy
{:handlers {:ataraxy.error/failed-spec #ig/ref :my.handler/error}}
:my.handler/error {}}my.handler/example.clj
(defmethod ig/init-key :my.handler/example [_ options]
(fn [{[_ body] :ataraxy/result}]
[::response/ok (io/resource "my/handler/example/example.html")]))
(defmethod ataraxy/result-spec :example [_]
(s/tuple any? :my.spec/example))my.handler/error.clj
(defmethod ig/init-key :my.handler/error [_ options]
(fn [{[_ error] :ataraxy/result}]
(let [messages (map f/format
(-> error :clojure.spec.alpha/problems))]
[::response/bad-request {:messages messages}])))Metadata
Metadata
Assignees
Labels
No labels