Home > Enterprise >  How can i access evironment variables in present NodeJS from ReactJS
How can i access evironment variables in present NodeJS from ReactJS

Time:03-17

I want to use my .env variable presend in my nodejs root folder in reactjs. I tried using process.env.TEST but i always get undefined. any solutions?

My folder structure.

Project root
 |-client
 |  |- //react project files
 |  |-app.js
 |
 |- //nodejs project files
 |-.env
 |-server.js

I want to access my .env variables in app.js and its components

CodePudding user response:

You can use find-up to get your variables in your whole monorepo.

Find here a bright article on the usage.

  • Related