DEV Community

Cover image for 📢Stop adding API_KEY to tutorials. Do this...
Ayobami Ogundiran
Ayobami Ogundiran

Posted on

5

📢Stop adding API_KEY to tutorials. Do this...

There are so many tutorials out there that add API_KEY to code.

And some other people now use their keys. Don't do that again.

📢 Do this instead 👇

const API_NAME = "myAPI";
const API_KEY = prompt ("Enter your API_KEY:");
Enter fullscreen mode Exit fullscreen mode

This gives you the chance to test your code and learners can create their API_KEY to test it.

Note: This is only for the browser 👋.

You can further explain the normal way to do it and why you do it that way not to confuse learners.

Thank me later 🤩.

Top comments (3)

Collapse
 
thomasbnt profile image
Thomas Bnt

I use dotenv for keys and others sensitive data 💪🏼

Collapse
 
codingnninja profile image
Ayobami Ogundiran

How did you use dotenv in the browser?

Collapse
 
thomasbnt profile image
Thomas Bnt • Edited
Comment hidden by post author

Some comments have been hidden by the post's author - find out more

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay