How to read environment variables

Viewed 28

env file is in root directory. I run my server with npm run dev

.env

STRIPE_KEY=1234

When trying to use it in a js file const API_KEY = process.env.STRIPE_KEY

Im getting following error:

Cannot read properties of undefined (reading 'STRIPE_KEY')

0 Answers
Related