I have a constants.js file like that:
var keyvalues = {
"var1": 0.08,
"var2": 0.08,
"var3": 0.07,
"var4": 0.065
}
And I want to change value from another js file.
My app.js file like that:
app.post('/updateValue', (req, res)=>{
let a = constants.keyvalues
const existingKey = req.body.key;
const newValue = req.body.newvalue;
constants.keyvalues[existingKey] = newValue; =======> (1)
})
(1) : in this line I want to update value from constant.js file.
And my app.js file will on production stage. I want to use this endpoint for update some values physically.
What is the right way for changing values on constants.js file from app.js file?