codedamn

Building a To Do app with queries + mutations

Created by Codedamn about a year ago

0

No description provided

6 Comments

    0

    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.

    @jamesarnold

    James Arnold

    @jamesarnold

    0

    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:

    1. 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.

    2. 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

    0

    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.

    @smitamahata

    SMITA MAHATA

    @smitamahata

    0

    Go to "package.json" and write "proxy": "http://localhost:1337" there. Hopefully you'll be able to resolve your errors.

    @talhashahid

    Talha Shahid

    @talhashahid

    1

    So confused .

    @subhams

    Shubham Sharma

    @subhams

    0

    Nope, did not get anything , hopefully when I properly learn express and node then I surely will revisit this class.

    @pranshubasak

    Pranshu Basak

    @pranshubasak

Your comment