Dealing with json.
Closed this issue · 4 comments
Hello there.
I am probably highly biased by ssr frameworks from node.js side but can we introduce "/api" folder which would work as "/pages" but serve json responses? Sometimes using non htmx approach and having more "typical" web framework would be a nice.
Best,
Michal
you can already serve json responses from the pages folder
example index.sh
:
# headers
header Content-Type application/json
end_headers
cat <<-EOF
{
"hello": "world"
}
EOF
Ok, still I would say that having separation between api and pages would be a good option for scaling the complexity of apps. But, is see your point :).
If you don't have plans to add "/api" then I would just suggest to add that example into documentation.
i guess my question would be what's the functional difference between the two?
and also, what should happen if there is a name collision in the pages/
folder vs the api/
folder?
True. That would force more changes. I've read the implementation more carefully. I see that I can archive everything with existing solution. Thx. Closing this topic :)