I'm trying to better understand the logic the connects frontend and backend.
So, say I am building a web app in a web framework, in my case Phoenix/Elixir, but could be Django, or RoR. And I want to replace my View with something like React, Ember or Elm. How do I have these two apps talking to each other?
As far as I understand it, this would primarily be through HTTP calls to the backend API that would be built as part of the Phoenix app. And the Frontend could be either an entirely standalone application, (using Ajax?), or a part of the View created by the backend, as in
<div class="app">My Frontend app</div>
though both would still get their data from the API? I understand there is also Web Sockets, which I believe could replace the HTTP transport.
So, basically, am I right in thinking the frontend would get its data from the backend through an API, or is there another method? And what are the pros & cons I should take into consideration when choosing which method to integrate my front end UI with the backend?