You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
template - which may be an atom or a string. If an atom, like :index, it will render a template with the same format as the one returned by get_format/1. For example, for an HTML request, it will render the "index.html" template. If the template is a string, it must contain the extension too, like "index.json"
The text was updated successfully, but these errors were encountered:
Yeah, we read that Gist and it makes sense.
However we weren't able to get it working consistently in our demo app.
Also, we didn't want to have to create a .json template for each route handler.
If you can demo it based on the Accept header, please share. 👍
Phoenix can already implicitly render different responses based off the
Accept
header or through forcing a type through theput_accept
plug.Will render "index.json" or "index.html" implicitly.
See https://gist.github.com/chrismccord/31340f08d62de1457454.
In the Phoenix Docs: https://hexdocs.pm/phoenix/Phoenix.Controller.html#render/3
Specifically;
The text was updated successfully, but these errors were encountered: