After I update the data in the database, refreshing the page will not display the new data.
The code is as follows
data.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
index.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|
The solution is to write the content in data.js to index.js (write it under the routing control function), so now I have a question, what is the mechanism of require? Execute? But it still doesn't work if I put the require under the router.get function, so I would like to ask how to refresh the data if I want to write it separately.
phpcn_u15822017-05-31 10:40:55
Promise state is irreversible and non-repeatable.
When data.js is loaded, p is assigned to a Promise object and subsequently executed, then becomes the Resolved state, and then handed over to index.js. When http.get
ends, the status of p has been locked to Resolved (assuming success). No matter how you refresh the page later, p will still be the original p, and a new Promise will not be regenerated.
You can see this example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|