Best structure for writing back to a 3rd party API?


#1

Hello,

I’m trying to learn the best architectural patterns to use in Meteor if I want to support this flow:

  1. Consume some data from a 3rd-party API
  2. Making changes to the data in my Meteor app
  3. Always save any changes I make back out to the API

In other words, I want the API to be the ongoing source of truth for my data.

As it stands, I’m able to pull in the external data and save it to a collection. Where I’m get hung up is on saving back to that same API. When is the right moment to do it? Should I use an .after.update collection hook? Should I abandon my local collection altogether and just rely on API calls?

Thanks for any tips or links! I just can’t seem to find any good recipes/best practices for this.

Adam


#2

To follow on, I just came across this article about Apollo and Anatomy of a Mutation. Is adding Apollo the best way to structure an app as I described above?