One of the handiest modules in the NodeJS ecosystem is the dotenv module. With this module you can create a
.env file and place your environment variables for your application, then you can load them into your application using a
require('dotenv').config() function. In Deno, we do not have require, and Deno handles the loading of environment variables differently.
With Deno, you call, instead of the NodeJS way of
process.env being a simple object. The
Deno.env is not a plain object. You can access the values using the
dotenv for Deno
There is a dotenv for Deno, that is even easier to use than dotenv of NodeJS.
load.ts module from the
import "https://deno.land/x/dotenv/load.ts"; console.log(Deno.env.get('GREETING'));
And now you can access your config information from a
.env just like you would access environment variables in Deno.
Deno has some different updated technology that still takes getting used to, but many libraries that we use in NodeJS have alternate libraries in Deno now and can serve the same purposes. Check out the Deno Third Party ecosystem for these implementations.
hyper is a service framework built using Deno, check hyper out at https://hyper.io, learn how you can build scalable applications using hyper.