Quantcast
Channel: Best practice when using an API key in Node.js - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Best practice when using an API key in Node.js

$
0
0

I have an API key I'm using in my Node.js application. Currently, I keep it stored in a text file and put it in a global variable when my application starts up.

Sooo basically it's just:

var key = getKey();
useKeyGetData(key);

I don't like having this global variable, and it's a pain to pass between files. Is there a better way to get my key where/when I need it? Is there some standard for doing so?


Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>