Issue communicating with backend and frontend on same machine (localhost)
Hey any full stack devs here, how did you work with , hmm basically i have made simple server with mongo then run in on host:3000 then building react frontend host:5173 but on working with Axios or fetching data from server it throws me error what am i supposed to do am i missing something (basically it is error or some cors policy), Is there any yt video or blog on fixing it
8 Replies
posting the code involved and the error messages would be neat if you looking for help with debugging
And the error image or copied
Add cors to your express app
npm
cors
Node.js CORS middleware. Latest version: 2.8.5, last published: 5 years ago. Start using cors in your project by running
npm i cors
. There are 12803 other projects in the npm registry using cors.that solves the issue is this a standard practice for all projects out thers
Yes, but you may still face other issues that you will need to add credentials and content type etc
But then, since it works happy coding
yupp thankyou for helping me out