Search code examples
reactjsgraphqlfetchapollo-server

How can I fetch data from a graphql structure which is in github?


I have a link to this repository ( https://github.com/scandiweb/junior-react-endpoint ). My question is, how can I clone this graphql structure to my react project and fetch data from it?


Solution

  • You need to clone or download the file from the github to your local repository. You will find the link to the top right corner of the box that contains the code. if you do not know this, just simply google "how to clone or download github repo" and dig it.

    Secondly, you will find the instruction in the readme section of this repo.

    1. install the dependencies.
    2. yarn build
    3. yarn start

    starts the server and you can make request at localhost:4000/

    How you can fetch data is either use apollo-client or opus and use it. You need to learn how to fetch data with graphql and how graphql works in the first place. Best of luck!