duct-framework / module.ataraxy

Duct module and router for the Ataraxy routing library
5 stars 4 forks source link

Question: What is the preferred way to set default value for optional parameters? #9

Closed hden closed 4 years ago

hden commented 4 years ago

It might make more sense to set it in the handler, but assuming that I'm using a handler library such as handler.sql, should we create a custom middleware for that or there is a way to specify them in the router?

weavejester commented 4 years ago

Ataraxy supports Clojure destructuring, so you should be able to use :or to specify defaults. I think I'd be inclined to specify defaults in code, but I haven't given this extensive thought.

hden commented 4 years ago

Aha! Thanks!