Fork me on GitHub

I have a duct app using module.web. How can I use the duct.module.web/site defaults, but add the content negotiation that comes with duct.module.web/api?


I see there's a key in /api called :duct.middleware.web/format. Can I add that to my /site config?


quote from @weavejester

The +site profile hint uses the :duct.module.web/site module, while the +api hint uses :duct.module.web/api.

The difference between the two modules is essentially in what middleware they add, and how the middleware is configured. An SPA would sit somewhere between the two.

I plan to write a dedicated :duct.module.web/spamodule soon. In the meantime, the best configuration would probably be to start with the site middleware, then add the content-negotiation middleware from the api middleware. So:

:duct.module.web/site {}
{:middleware [#ig/ref :duct.middleware.web/format]}
:duct.middleware.web/format {}
If you're curious about the exact differences, you can try using both modules, then running (pprint config) in the REPL to see exactly what keys the modules add.


Perfect! thanks @jahson


@myguidingstar, I stumbled across that and was trying to adapt it to my config 🙂