2 ms·
I agree in the case of HTML rendering, but I write a lot of JSON APIs and putting the JSON definition in the View has been very pleasant. It didn't say in OP,
by freedomben 4y ago
I agree in the case of HTML rendering, but I write a lot of JSON APIs and putting the JSON definition in the View has been very pleasant. It didn't say in OP, but how does this change an API? Maybe a `GreetJSON` instead of `GreetHTML`?
- a_bored_husky 4y agoYes, exactly like that.
- eclark 4y agoCorrect. You write a moduleJSON. So this is about what we have for one of our controller/views: defmodule MyWeb.SystemStateJSON do def index(%{summary: summary}) do %{data: summary} end end