Reputation: 179
I'm running a local server with express. The server is able to display some local files from my computer. Amongst them there is a file called "lastResult.txt" which gets updated every time I run a bash script.
For some reason, when I run the server and try to display the file, it shows a version from a week ago. This file file has been updated locally more recently than a week ago. This persists even after restarting the server or even on different browsers.
I am using the serve-index module to display directories.
Upvotes: 3
Views: 2799
Reputation: 1551
This question has already been answered.
I'm adding to it in case someone needs an example of a problem like this, (that is non-obvious).
Had a similar problem while using EJS and express.
../pages/base.css
./base.css
but instead I referenced it like base.css
./base.css
fixed the problemUpvotes: 0
Reputation: 111336
You didn't say how do you serve the static files - with express.static or with some custom handlers. The express.static doesn't cache the files but your custom handlers might. In any case, those files can be cached on the client depending on the value of ETag and Max-Age but even then they should not persist after accessing with another browser.
From what you're describing it seems that you are not updating the correct files, or in the correct directory. Of course it's impossible to be sure since you didn't include even a single line of your code so one can only speculate but it seems to be the case.
Upvotes: 4