Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 task done
nelsonic opened this issue May 18, 2020 · 4 comments
Closed
1 task done
Assignees

Comments

@nelsonic
Copy link
Member

nelsonic commented May 18, 2020

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.
@nelsonic
Copy link
Member Author

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

Going to use it.

@nelsonic
Copy link
Member Author

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

Working on docs now. 📝

nelsonic added a commit to dwyl/phoenix-content-negotiation-tutorial that referenced this issue May 19, 2020
@nelsonic
Copy link
Member Author

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. 👍

@nelsonic
Copy link
Member Author

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant