Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
freedomben
on Dec 30, 2022
|
parent
|
context
|
favorite
| on:
Phoenix 1.7 is View-less
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`?
eclark
on Dec 30, 2022
|
next
[–]
Correct. 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
a_bored_husky
on Dec 30, 2022
|
prev
[–]
Yes, exactly like that.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: