read-dotenv-files

This repository contains small scripts as well as instructions to read .env files in several languages.

View the Project on GitHub Baelfire18/read-dotenv-files

JavaScript/Node Dotenv

For using it in node first you have to have:

  1. A Node version installed.

  2. Installed the node-dotenv package. You can do it just by running npm install dotenv --save.

For a .env file like this:

require('dotenv').config(".env");

const DB_NAME = process.env.DB_NAME
console.log(DB_NAME);