Finally, register our new mutations in the HTML element: we want to be clickable to show the update form. These components are so similar that we can put most of the logic into the reusable finds it in cache and makes changes (components are re-rendered too). We learned the difference between mutations and queries, learned how to implement them at the back-end, and how to use them from the front-end.
Now our application supports user sign-in and library management, so it is almost ready to be deployed to production!
Here is the overview of our authentication mechanism: , to perform authentication, a base64-encoded email address as the authentication token, and an “Authorization” header to pass the token.
Note that it’s not necessary to authenticate users using Graph QL API: it could be done “outside”, e.g., via the good old REST.
The second part of this tutorial will cover mutations (the way to update data) and advanced topics about client caching.
In the first part of the guide we learned about what Graph QL is, and created a very first version of the Martian Library application.
Let’s add a mutation for adding new items to the collection. If we are confident enough in our server, we can use an optimistic update.
As usual, we need to define the arguments and the return type: You might have noticed that we have a lot of repetition in these two classes—no worries, the third part of this series will cover refactoring techniques we can use to fix this. Let’s add some more components for creating and editing items. Let’s add one more argument to the update Item function: That’s all for today!
There is no restriction for the databases you are connecting. You can still upload the JDBC driver and get connected ! You can run Db Schema on all operating systems: Windows, Linux, MAC.