G
G
GreaterGlider2019-04-28 13:58:20
React
GreaterGlider, 2019-04-28 13:58:20

How to update data in a React app without rebuilding?

Good day to all!
There is an application that uses data in json that is loaded locally via include (not pulled from any server or API). This data is rare, but still has to be modified, and now this process looks like modifying json, npm build and uploading the entire build to the server. Which is not very convenient.
The question is how do they act in such situations, is there any best practice? While it comes to mind to put json somewhere near the build and pull it through fetch and modify only it alone, but in this case it also becomes necessary to climb the server. Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Spirin, 2019-04-28
@GreaterGlider

1. Write a script to deploy the application. json to leave in the assembly. Deploy changes with one command in the console.
2. Update data with a script via ssh connection. json to take out.
3. Write a simple admin panel and update data through it. json to take out.

E
EmachinesDIMA, 2021-11-08
@EmachinesDIMA

rebuilding the project is not a good idea. He himself hung over the implementation of this task.
there are several options in my head so far:
1. save data in a third-party storage (on the server where the application is deployed or in gitlab artifacts so that you can download the data). But I have been fighting with this for a long time and I can’t curb it in any way. Here is my question on this topic: https://qna.habr.com/q/1068706
2. Use the implementation with gateway_nginx - an intermediate state where each service is started with nginx independently: react+nginx , gateway+nginx, CMS+nginx . This is where a balancer like traefik or HA comes in handy, or you can use proxy_pass nginx to beat
this....

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question