module.Exports mount an array with the api data

Asked

Viewed 115 times

0

Well I’m having the following problem is I’m not getting it at all.

Well I have a script config.js

module.exports = {
    "adsense": {
        "bloco728x90": {
            "google_ad_client": "ca-pub-x",
            "google_ad_slot": 00
        }
    },
};

Only that this information I wanted to take the api localhost/api/Adsense is mount the array with the received data.

Using the http.get() I can list the data received, I just can’t use the http.get along with the module.exports to build config.js without having to edit the file every time I update the information in the api.

1 answer

0

There’s a package on Ode that’s just for this.

https://www.npmjs.com/package/config

You pass the context of the environment and it gives you the right config.

I hope I’ve helped

Browser other questions tagged

You are not signed in. Login or sign up in order to post.