1

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

asked Feb 23, 2017 at 18:33

1 Answer 1

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....

answered Feb 23, 2017 at 18:42
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.