Hi I am new in react application. I want to set Public_URL in .env file .
.env file (I set my url link)
PUBLIC_URL="http://localhost:8000/api";
Login.tsx file
const response = await fetch("/login", {
method: 'POST',
headers: {'Content-Type': 'application/json'},
credentials: 'include',
body: JSON.stringify({
userName,
password
})
});
When i start the application, My application should be work fine. But In my Login page I submit the Login button My Url call to http://localhost:3000/login. But I need to set http://localhost:8000/api . I don't know how to set it. Please send the correct example.
Package.json
"scripts": {
"start": "env-cmd -f .env react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
