Is there anyway to write to a MySQL database from my Fuse app? For example, I am using the fetch() function to pull votes from the server and when someone swipes a card to the right I want to increase that specific card’s vote by a value of 1. I have been working on this for days and I am stuck. Any help is appreciated!
Generally speaking, you would never do anything directly to a remote MySQL database from a mobile application. Unless it is a “MySQL management” application, which I assume your app is not. What you need to have is something in the middle and usually, that thing in the middle is called a REST API. Best case scenario: one that supports JSON.
If you say that you’re pulling votes from a server by using
fetch(), exactly what URL does that fetch request of yours use? I imagine it would be that REST API I’m talking about above. Can you show us some of your code?
Next, if you can figure out what REST API you’re using, it should be fairly straightforward to find a method that would allow you to post updates to it, such as “increase vote by 1 for an entry”. If you’re building your own REST API, it’s even easier: just make whatever methods you need. However, this is not related to Fuse and we can’t provide any support regarding your backend implementation.
Here, we have an article on working with REST APIs from Fuse.