Search code examples
javascriptnode.jsaxiosserver-side-renderingquasar

Quasar + Vue + SSR - How to hide sensible data, like API Keys


Been working a week on Quasar Framework and were wondering how to hide sensible data on server side.

Let's imagine I want to fetch some data from third party site, with the use of my own API Key. How could I keep axios requests and API Keys on server side, and retrieve only the fetched result to user?

Regards.


Solution

  • I use dotenv in my node projects. The basic workflow is to create a .env file in your project's root directory. This file should hold the sensitive data in per-line key=value pairs.

    Then, add .env to your gitignore so your API keys aren't checked into your source control. The .env file will need to be included in your deployment to the server, and the dotenv library should be able to read from it.

    Some dev workflows use a .env.development file that holds development api keys.