All worked well but now i am not able to call api via axios or fetch i had add my api main url in package.json in proxy setting .... can you help me what should i do
The proxy feature isn't meant for production. Proxy is most suitable in the Development environment but when you deploy your app with prod mode on a web server then you need to do it in different ways.
Few links for your references: create-react-app.dev/docs/proxying... github.com/facebookincubator/creat...
I have created a web app with frontend React and nodejs backend.
I want to host web app on windows IIS web server.
In IIS Prdouction env.Application working fine but react app failes to connect with backed nodejs.
In vs code development environment it's working fine but on production iis server not working.
How do I resolve this issue?
Showing Error
Request Method: POST
Status Code: 404 Not Found
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
All worked well but now i am not able to call api via axios or fetch i had add my api main url in package.json in proxy setting .... can you help me what should i do
The proxy feature isn't meant for production. Proxy is most suitable in the Development environment but when you deploy your app with prod mode on a web server then you need to do it in different ways.
Few links for your references:
create-react-app.dev/docs/proxying...
github.com/facebookincubator/creat...
One way you can do it by using the environment variables.
create-react-app.dev/docs/adding-c...
so for development create file
.env.development
outside of src folder and add your API URL like:For Production create file
.env
outside of src folder & add your Prod api base url like above.once you configure your API URLs you can simply use it in your as App as below:
I hope this solves your problem. Please let me know if any queries.
I have created a web app with frontend React and nodejs backend.
I want to host web app on windows IIS web server.
In IIS Prdouction env.Application working fine but react app failes to connect with backed nodejs.
In vs code development environment it's working fine but on production iis server not working.
How do I resolve this issue?
Showing Error
Request Method: POST
Status Code: 404 Not Found