I need to continuously sync with backend API. What are the changes done in backend it should be reflect back to front end in vue? How to continuously sync with API? Is the only way to set interval and call API or is there a better way?
If you only require that the frontend receive information from the backend then you could use something called a stream. You could create a readable stream that your Vue app listens to.
https://developer.mozilla.org/en-US/docs/Web/API/Streams_API
If you require that the front and backend communicate with each other, then you could use web sockets:
https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API
A very popular javascript library for this is socket.io.
https://socket.io/
There are a lot of guides on the internet about how to set it all up. If you have any further questions, I recommend creating separate questions on SO.
i use Key id for update real time table from json file .
Related
I am trying to figure out how to pass data between the theme-app-extension and the backend of the application that the theme-app-extension is connected to. The theme-app-extension is all liquid, css, and javascript so I wasn't sure if there was a built in way to pass data between the two. For example is there a suggested method to pull data into the theme-app-extension from the database and is there a suggested way to send data to the database from the code running the theme-app-extension? I am fairly new to doing anything with theme-app-extensions as well as building Shopify applications. I have built Shopify applications that was admin facing or just cosmetic, this is my first time building a Shopify application that takes user input and sends it to the database and retrieves that data for the end-user to see.
Any suggestions would be greatly appreciated.
Thank You.
I started working on Shopify App (Theme App Extension) a week ago
I run into the same problem, so I did consume API in a javascript file using Fetch
Here is an example of the code:
I add this into global.js file inside assets
And then I linked the script files inside my Liquid block
Also inside global.js, I did manipulate DOM by injecting data consumed from API, here is an example
Finally what I did is communicate directly with DOM to inject or retrieve data, then handle it using javascript
I hope this helps you
Ps:
This is my first experience with Shopify too, and I was quite disappointed (lack of resources, docs, and community)
You usually (always) pass data from the front-end to the back-end using an App Proxy. There really is no other way at this time. The Proxy gives you an XHR call you can use, and you can return Liquid or JSON. Your choice.
I'm a beginner in react native and I'm working on a mobile app for school. Within it, I need to send and receive data (draw graphs) from the cloud. We use cloud services from Mathworks - Thingspeak. Would you please advise me on how to start this communication? Is it necessary to set this communication on every screen where graphs will be displayed or send data? Is it possible to use write & read API keys for this task?
Thank you for every answer
You can use REST API for communication,
For read: https://www.mathworks.com/help/thingspeak/readdata.html
For write: https://www.mathworks.com/help/thingspeak/writedata.html
There are example requests on both pages.
You don't need to install a separate package, you can do it with fetch
Let me know if you succeeded, or I can help again!
I was thinking about some projects that I could do, and I came with the idea of building a books app in React native. To start, I wanted the user to get a list of all the books and the ability to get the details about each book and some other things. But I'm completely new on the backend, and my doubt is:
Should i use the features of the backend, such as a database or should I just create a simple serve that only sends a JSON to the frontend?
You should use a database as it is more flexible and easier to manage, and using any backend framework to forward your data in json format to your frontend, I would suggest mysql server and slim php framework
Ive been making API's for about a year now and I was taught to use http://IPAddress:Port/api/v1 all the time when building an API with express.js. Is there a specific reason I would want to do that? Is this just denoting that the API is in development? Ive recently changed my API to not run on port 3000 so that I am able to just say http://IPAddress.com/ instead of http://IPAddress.com:3000/api/v1 and it works just fine the new way.
One main reason for versioning an API is because it may be that an API can be improved upon but doing so might lead to breaking changes (for example, it might not work for applications that are consuming the API because an endpoint has been modified).
So, the solution to this is to allow consumers of the current API (v1) to keep using it until they want to switch, and release an updated version (v2) for new consumers.
Here's some more info on it: https://restfulapi.net/versioning/
I am creating a react-native mobile app for a service that has to interact with the service's API to get and update data.
This service also has a web interface through which users can sign in and use the service (aka getting and updating data.
Since I am only developing the mobile applications, I have no access to the code on the web side of things and my only way to make changes to that code is to go through someone else.
From the resources available online, I feel like I should be able to make a mobile app that interacts with and updates data through the API, however my thought process for how I am going to handle a user updating data through the web interface and reflecting that in the app has hit a standstill.
Does anyone know of a term that I can use to describe this in such a way that I will likely find more results online (or even better, a react-native npm package that achieves this functionality)?
So far I have tried searching the following, but have found few results:
redux caching
handling data updated on the server redux
redux how to handle data changing on the server
how to handle database updates redux
Sockets.io seems like it would work for realtime updates.
Essentially, it works by shifting the connection from a request-based HTTP deal (where the client asks the server for stuff) to a websocket in which the client and server can send each other things (like database changes :D) over a constantly open stream, even if after a delay.