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
Sturlen
Sturlen16mo ago
posting the code involved and the error messages would be neat if you looking for help with debugging
Lopen
Lopen16mo ago
And the error image or copied
pugazh__
pugazh__16mo ago
Lopen
Lopen16mo ago
Add cors to your express app
Lopen
Lopen16mo ago
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.
pugazh__
pugazh__16mo ago
that solves the issue is this a standard practice for all projects out thers
Lopen
Lopen16mo ago
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
pugazh__
pugazh__16mo ago
yupp thankyou for helping me out
Want results from more Discord servers?
Add your server