PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, August 20, 2022

[FIXED] How can i access evironment variables in present NodeJS from ReactJS

 August 20, 2022     environment-variables, express, javascript, node.js, reactjs     No comments   

Issue

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


Solution

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

Find here a bright article on the usage.



Answered By - Guillaume Duhan
Answer Checked By - Cary Denson (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing