0

I currently have an application built with Express.js that runs via Heroku. I need to define a global variable that I can decrement each time a specific function is called, but I'm not sure how to do that programatically. I have a file of constants called consts.js and was trying to just set the variable (REMAINING) as follows: CONST.REMAINING -= 1 whenever the function is called, but unfortunately that doesn't work. What is a better way to go about this?

1 Answer 1

1

There's a good explanation of Heroku’s ephemeral filesystem which is a good place to start. In a nutshell, do not use the /tmp to store any variables or application level data as it will get destroyed.

It is suggested to use Amazon S3 or a similar durable store. It may be overkill for a single variable but I would look at using Redis just because of its speed. You could also look at programmatic access of Heroku config vars as well.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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.