web_api_with_cpp icon indicating copy to clipboard operation
web_api_with_cpp copied to clipboard

Testing your code on a live server

Open faizol opened this issue 4 years ago • 3 comments

Hi, I just tested your code on a live server (to study react deployment with c++ backend). It seems that the reactjs frontend can't communicate with the c++ backend as the result is always "TypeError: NetworkError when attempting to fetch resource.".

Any idea on how to fix this? Thank you.

faizol avatar Sep 15 '21 06:09 faizol

@faizol I had the error image

Have you solved it?

I am also studying react with c++ as server. It would be appreciated if you could share any other study material. I did not find any examples using react and c++.

yaojiadong avatar Oct 16 '22 18:10 yaojiadong

@faizol @yaojiadong

Hello, sorry for late response, I've just seen your questions. Refer to the following link, I think, it will solve your issue, please let me know if it works for you.

Allow Cross-Origin Requests in Restbed

reza-arjmandi avatar Oct 17 '22 04:10 reza-arjmandi

Hi @reza-arjmandi , thanks for your response. I don't quite get your point. Do you mean using _settings->set_default_header( "Access-Control-Allow-Origin", "*"); ? This is the code that we are running, but it does not work.

Could you please point out what you exactly mean by that link?

yaojiadong avatar Oct 17 '22 07:10 yaojiadong