I am working on a React JS application. Where I am using PHP and MySQL at the back end and React JS at the front end. What I am trying to do is to make a simple API 'fetch()' call to the back end and to get some data. My React App is running on "http://localhost:3000/". I have made a folder called "api/index.php" in the root directory of the React Application. When I try to make the call I get the error "File not found : 404". I don't know why.
Fetch API in a component
fetch("/api/index.php", {
method: "POST",
headers: {
'Content-Type': 'application/json'
}
}).then(res => console.log(res))
Please note that I am running the whole app in
wampserver directorywww/react-app/
