Make serverside Graphql request in a proxy request

kupokupopi
New Member
1 0 0

Hi,

I followed the https://shopify.dev/tutorials/build-a-shopify-app-with-node-and-react/ tutorial and it all works, and now I would like to build on top of that. My goal is that every shop that has my app installed will have an endpoint available that exposes the shipping methods in JSON.

So my idea was the following:

I create a proxy request that goes from https://<store>.myshopify.com/a/data to https://<myapp>/data and then in my app I will make a GraphQL request to store that proxied the request, and return some data.

My problem is that I don't know how to get the store name and access token from the proxied request. I have set up the '/data' endpoint in my app and I can see that the requests get there, but how can I make a GraphQL query for that store?

router.get('/data', async (ctx) => {
        console.log(ctx)
        ctx.body = 'Testing the data route'
    });

There isn't anything in the ctx object that I can use to make a request to the graphql endpoint?

 

0 Likes