Backend API - Storing API Keys

Backend API - Storing API Keys
0.0 0

#1

Hello fellow campers,

Can anyone recommend me some tutorials on using node.js to create a backend that stores API Keys for my applications to call via AJAX?

I have been searching for a while now and there doesn’t seem to be any in depth tutorials I can find.

Thanks in advance :slight_smile:


#2

Have you worked with Node before? Used it to set up a server?

I just finished working through the API projects, and I don’t have any tutorials to recommend, but here are some resources to get you started:

  • If you haven’t set up a server before, working through Express’s “getting started” guide really helped me get things up and going.
  • I used the npm request module for API calls - that seems to be the most common.
  • As for the API keys - have you worked with environmental variables before? That might be a search term you haven’t tried. Anyway, I stored my api keys inside of a file named .env (and made sure that that file didn’t end up on github). If you’re on Windows, you can use dotenv to access those variables (there’s instructions in the documentation).

Don’t know if that helps any?


#3

Thanks for the reply Agatha!

I’ve used Node and npm request module before, but I’ll definitely look into a couple of your suggestions. I was hoping to see a couple of examples on going through the process. I’ll be sure to take a look at the dotenv module for environmental variables. Thanks!


#4

I also use the dotenv package, and a .env file. One thing to remember: be sure not to commit your .env file to GitHub. :smile:


#5

Thanks Zack! I’ll be sure to look into using dotenv. Thanks for all the recommendations!