I have already created some models and controllers using
mix phx.gen.html. I need to serve context as
json. My question, should I create new controllers to serve
json or is it better to modify current controllers to serve html/json depending on request type?
How to create new
json controllers for existing models, what is the Pheonix / Mix way to do it?
And, inside say an index method, how to check request type and serve html/json accordingly? Thanks.