Continuing my explorations of RxDB and Rescript, this article hooks up mutations to allow RxDB to automatically sync its offline-enabled changes to the graphql server.
I’ve become quite comfortable in Rescript over the course of the past few months. So far in this long-running series, I’ve implemented an RxDB powered offline-enabled application in Rescript. I’ve also written a graphql server using express. In this article, we’ll connect the two so that the RxDB frontend can sync with the graphql database.
In the previous article we implemented the sync read endpoints between our graphql server and our RXDB client. In this one, we’ll hook up the mutations.
Now that our Rescript client and server have the same data model, we can hook up the graphql endpoints to sync the offline rxdb database with the graphql server.
Now that our RxDB models are complete, we can hook it up to a react app for a complete offline experience.
Extending the JS bindings I’ve modelled in previous articles, in this add bindings for subscribing to queries, and hook those up to Application state.
In an earlier article, I started modelling RxDB calls from rescript with the intent of building an offline-enabled Rescript app. This article continues from that base, modelling collections and queries.