dwyl/content

[SPIKE] Create Content Negotiation Plug that *Any* Phoenix App can use!

nelsonic opened this issue ยท 4 comments

We have show that content negotiation is fairly straightforward in a Phoenix App in our tutorial: https://github.com/dwyl/phoenix-content-negotiation-tutorial
but our conclusion is that it's quite cumbersome.

We need a simplified way of doing content negotiation in our App(s)
whereby we only add one line to the router.ex and one line to each controller.

I think it's possible, but I don't know for sure. ๐Ÿ’ญ
I would prefer to avoid including Phoenix as a Dependency ... because of maintenance and RAM.
So this issue is a "SPIKE" to:

  • explore how to do content negotiation in a reusable plug.

Didn't expect this name to be available on Hex.pm: https://hex.pm/packages/content
image

Going to use it.

Shipped: https://hex.pm/packages/content
image

Working on docs now. ๐Ÿ“

I have used the content plug in the tutorial "Part 2":
https://github.com/dwyl/phoenix-content-negotiation-tutorial#part-2

It works exactly how I imagined. โœ…
And if I didn't have to use the & to "capture" the plugs it would look good too. ๐Ÿ‘

done โœ