Building a To Do app with queries + mutations
Created by Codedamn about a year ago
No description provided
I changed the fetch url to "http://localhost:1337/api/get-records" This allowed the frontend to send request to the backend server, but I got a cors issue.
I installed cors with "npm install --save cors" and added the following in server.js, right under the const app = require("express")() line: const cors = require("cors"); app.use(cors());
More details on this solution for the CORS issue here: https://medium.com/zero-equals-false/using-cors-in-express-cac7e29b005b
you don't say the 'why' behind what you're doing, only the what. 4:30-5:30 is an example of this - it leaves us as students lost, we don't learn. I've been trying to debug to get this working for a while but struggling to reverse engineer as there is little 'why' behind what you're showing us.
Hey Mehul I am coding along on VS Code and I am struggling to make this work because the frontend is trying to reach the backend server on the frontend port (3000), whereas the backend is listening on a different port (1337). You seemed to be doing something with regards to that at around 7:00, but it is not clear what it is that you are doing and whether this would work on VS Code. Also, I am using npm and you are using yarn, so that adds to the uncertainty.
In case someone has a similar issue, I got it to work by doing the following:
Hey Mehul I too have tried 3-4 times this things. But i didn't able to make it working. Even backend i have taken in different port (i.e 5000)and frontened (3000 ) port. Still i am getting error on request. I am not using yarn . Instead i am using npm. So could you please let me know how to fix this.
So confused .
Nope, did not get anything , hopefully when I properly learn express and node then I surely will revisit this class.