I have an axios helper file with a baseURL set in my react project. I have been told to remove the hard coded url and use process.env instead, but when I do this the requests no longer work for fetching the data and I get back a 404 GET error in my app.
import axios from "axios";
// axios.defaults.baseURL = "https://example-app-name.com";
axios.defaults.baseURL = process.env.REACT_APP_BASE_URL;
export default axios;
.env file in the root of my project looks like this - I am thinking maybe it cant find the .env file, I did install the dotenv library.
REACT_APP_BASE_URL=https://example-app-name.com
I get these errors
GET https://example-app-name.com 404 (Not Found)
Uncaught (in promise) Error: Request failed with status code 404