I want to share environment variables for my Node backend and my React frontend (create react app). I have followed below guide to set up the project.
Since my folder structure looks like below:
|project
|---.env <-- Want to use both for Node and React.
|---package.json <-- Node
|---client
|---|---package.json <-- React
|---|---src
|---|---|---index.js
|---|---|---app.js <-- Here I want to access .env in project root
The React app looks for it´s .env
file in the client folder root but I want to specify the path for it uses the .env
file in project root.
How can I specify the path in the React-frontend so it uses the .env file in project root?
Thanks in advance.