mosawi
mosawi

Reputation: 1323

How to implement a config file to replace literal values in node.js Web App

I have a node.js project which has a lot of literal values which constantly change every 6 months. I have an idea which is simple but I am not sure or know how to implement it.

I would like to replace these literal values with a config file which contains all these values, so when the data changes, I can just go to this config file to change these values.

Can someone please help me to do this?

Upvotes: 0

Views: 362

Answers (1)

Amadan
Amadan

Reputation: 198324

Make a JSON file. On app start, read the JSON, in the callback parse it and invoke your application. Or even write a YAML and install https://github.com/nodeca/js-yaml to parse it (nicer for humans).

Upvotes: 1

Related Questions