Company
Date Published
Author
Tierney Cyren
Word count
960
Language
English
Hacker News points
None

Summary

You can use environment variables in Node.js by accessing the `process.env` property directly or by using a library like dotenv. The `process` module provides information about the Node.js process, including environment variables that are provided to it. As of Node.js 20.6.0, you can load environment variables from an `.env` file using the experimental `--env-file` flag. This allows for easy management of secrets and avoids exposing tokens in your code. Alternatively, you can use the dotenv module as a dependency to manage environment variables in your project.