I have already tried some solutions from Stack Overflow but still unable to solve this. Need other solutions.
componentDidMount(){
this.getCar()
}
async getCar() {
try {
const response = await axios.get('http://127.0.0.1:8000/topratedcars');
console.log(response);
} catch (error) {
console.error(error);
}
}
Hi I think you can try exposing your local host to the internet using a service like ngrok which will generate a url for you, and then try using the url to send requests from your code. Simply download and follow the instructions here: https://ngrok.com/docs