I'm working with the OOP MVC pattern of building a web app. For my current project, I have to tightly intergrate data from an external API into my backend (node). It's the first time I've done this.
My application sends, recieves, and polls for data from this API service.
At the moment I have:
- an object that encapsulates the API calls.
- an object that polls the API and updates my app's database.
- mvc controllers that want to talk to my models and the API's data.
Some user actions include calls to this API. At the moment my controllers are making calls to the API handler directly and everything feels a bit messy and interdependant. I'd like to structure it in a way to minimise data syncronisation issues as well. Are there any standardised or good patterns of adding this kind of external API intergration into a ruby-on-rails style MVC pattern?