From fdbecad159c119444f062aa0344c05b5c266b32e Mon Sep 17 00:00:00 2001 From: James Reeves Date: Fri, 15 Nov 2024 04:01:30 +0000 Subject: [PATCH] Update README with option information --- README.md | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 149b133..19877a0 100644 --- a/README.md +++ b/README.md @@ -28,12 +28,31 @@ configuration: :example.handler/root {}} ``` -The `:routes` option defines the Reitit routes. Other options are -passed directly to the Reitit router. - Once initiated the `:duct.router/reitit` key will produce a Ring handler. +There are four top level options available: + +- `:routes` - the Reitit routing data +- `:middleware` - a vector of middleware to apply to the Ring handler +- `:data` - data to add to every Reitit route +- `:default-handler` - a default handlers for error conditions + +The `:data` key takes a map and acts as it does in Reitit, except for +the following keys: + +- `:muuntaja` - a map of Muuntaja options to be merged with the defaults +- `:coercion` - one of: `:malli`, `:schema` or `:spec` + +These keys will automatically add relevant middleware. + +The `:default-handler` key holds a map that takes the same keys as the +Reitit `create-default-handler` function: + +- `:not-found` - a handler for 404 HTTP errors +- `:method-not-allowed` - a handler for 405 HTTP errors +- `:not-acceptable` - a handler for 406 HTTP errors + ## License Copyright © 2024 James Reeves