I have a node.js app deployed correctly on Heroku. It's a simple app that stores some values in a JSON file and it read or update that file (like it is a database).
Everything works fine (creation of new nodes in JSON, deletion, editing etc...) but it seems that every X hours the JSON file is resetted as it is in the last commit pushed to Heroku.
Is there a way to handle this without using a database? (like MongoDb for example)
Thanks
1 Answer 1
Even with a minimal Heroku deployment, the design needs to account for a layer capable of storing state ( ie u mention Mongo ).
Your design should include a separate node from the Heroku ( app layer ) where the state resides and where your app has authorization to do HTTP actions (POST, GET) on the state stored in your JSON.
The reason for your intermittent resets/reverts of the JSON is involved with Heroku's service tier and with the fact that your apps state is cycling UP and DOWN .
Look for a sample Heroku app with minimal persistent layer....