I am trying to create an app using shopify cli

I am trying to create an app using shopify cli

Sajeel
Shopify Partner
272 31 26

when i try to call get function from server.js and console the response using fetch('/getproducts') function i see the error in console 

Response {type: 'basic', url: 'https://630a-182-176-104-93.ngrok.io/auth?shop=undefined', redirected: true, status: 200, ok: true, …}

how to solve shop=undefined

this is my function

router.get('/getProducts', verifyRequest(), async(ctx,res) => {
const { shop, accessToken } = ctx.session;
const url = `https://${shop}/admin/api/2022-01/products.json`;
const shopifyHeader = (token)=>({
"Content-Type": "application/json",
"X-Shopify-Access-Token":token,
});
const getProducts = await axios.get(url,{headers:shopifyHeader(accessToken)});
ctx.body = getProducts.data;
ctx.res.statusCode = 200;
});

Replies 0 (0)