Hey guys i didnt have this problem when I was building the app locally but as soon as i uploaded I have this problem I think Im not setting the url correctly for the post request, I say this cuz i get 200 for the request itself but its not sending the info I want its sending some bs from my index.html
Code:
const onSave= (price,time,carrierName)=>{
if(isAuthenticated=== true){
axios.post(`https://fathomless-ravine-04271.herokuapp.com/savedInfo/save`,{departureName,
price,destinationName,userId,carrierName,time,departureDate,userName})
.then(res => console.log(res.data))
}else{
return(
<p>Needs Login</p>
)
}
}
pic:
Hi Josh, it seems your backend is serving an HTML file as a static asset instead of processing the request as a REST API.
Can you post the backend code where you initialise the server and add all the routes?
1 Like
hey the problem with the backend was solved by me moving files but now i have a problem that the only api calls that work are api calls that are made to my backend rest of them dont work could u help plz? this is my code:https://github.com/khrismuc/FlightTicket-Reservation
Which API calls are you referring to when you say “rest of them”? It helps if you provide a screenshot and paste the relevant code that’s not working as expected.
1 Like
sorry for the late reply fixed haha thanks for the help !