Open
Description
Are there any thoughts about creating a client framework for interactions with a Phoenix Backend.
Like programmatically mapping resources/routes, error handling (messages) etc.
Would make sense I guess, so for example, interaction with Modules, GenServers etc.
One could just get the generated script directly from the server.
Just consider the following idea:
defmodule API.Accounts do
use ClientInterface, "Accounts"
api("getUser", jwt, id \\ nil) do
Accounts.get_user(id || jwt.userId)
end
end
<script src="/backend-api.js?module=MyAPI"></script>
<script>
MyAPI.Accounts.getUser()
.then(me => {
// got the current user, as there were no id specified
}).catch(e => {
// handle error
})
</script>
I think, that such a framework would make rapid development of apis and adoption of elixir very smooth. It would be possible to build other interfaces like sockets and such on top of that very straightforward.
Would like to know, what the community thinks about it
Metadata
Metadata
Assignees
Labels
No labels