dotenv supports environment variable from .env
file for Node.js project.
In this article, I would like to share initial configuration and some tip to use dotenv with TypeScript.
🐰 Installation
yarn add dotenv # npm install --save dotenv |
🍄 Configuration
Add .env
files in your project root, by the following command in terminal:
touch .env # for common configuration |
In .env
files, you can write environment variables like this:
# Example |
After then, please add ./src/utils/config.ts
to load the avobe files.
import * as dotenv from "dotenv"; |
🖥 Recommended VPS Service
VULTR provides high performance cloud compute environment for you.
Vultr has 15 data-centers strategically placed around the globe, you can use a VPS with 512 MB memory for just $ 2.5 / month ($ 0.004 / hour).
In addition, Vultr is up to 4 times faster than the competition, so please check it => Check Benchmark Results!!