All Questions
9 questions
0
votes
2
answers
2k
views
In my Vite/React project, I'm having trouble implementing an environment variable for my Openweather API key
I have an .env file in my root folder of the project.
I checked the API key and it is correct and I used the actual key in the URL instead of process.env.API_KEY and it fetched the data correctly
I'm ...
0
votes
2
answers
6k
views
POST http://localhost:5173/register 404 (Not Found) & axios error
I have been trying to get the response from the server but it shows error. I'm using vs code for this program. When I check the "process.env.MONGO_URL" using console.log() ,it says undefined....
1
vote
0
answers
178
views
Trying to create environment variable backend and frontend throw undefined
i am trying to create .env in my backend db url and my auth client id in frontend have the same error apparently it is not defined at least the server throws this error:
MongooseError: The `uri` ...
0
votes
1
answer
1k
views
Deploying a react application on an s3 bucket with multiple environments
I'm using heroku to deploy a nodejs backend, and amazon s3 to deploy the static files of a react app, so the frontend stored on an s3 bucket makes requests to the heroku backend.
Once I finished ...
1
vote
1
answer
3k
views
How to have different env files in Next.js app?
I want to dynamically switch the base url of the external backend API on changing the environment.
E.g .env.local=local.com, .env.staging=staging.com, .env.production=production.com
For this I'm using ...
0
votes
0
answers
648
views
process.env.REACT_APP_KEY not working with api calls
So far in 2 projects I created a .env file in the root of my project. I install npm install dotenv. I place (e.g.)REACT_APP_KEY='123456' in the env file . In my app.js file I add require("dotenv&...
1
vote
0
answers
178
views
How to set Environmental Variable in React js app?
In my project, I use axios for API. And I hardcoded these API links in my code. So I want to remove hardcoding and set env variables.
But I want such a setting that automatically considers the current ...
1
vote
1
answer
1k
views
React ENV & axios url fetching
Im currently fetching the env.production variable. with the local one, it works great, but when loading it to my webpage, im having some trouble.
its starting to call the url twice, etg:
http://...
3
votes
2
answers
11k
views
Changing Axios baseUrl accessible from env file after building React App
Currently I am using .env file placed in react app root folder with variable
REACT_APP_BASE_URL = http://localhost:8081
I user axios defaults to set base url for api requests
Axios.defaults....