javascript - Shopify API in node.js/React. How to read and write API in Shopify App?
Solution:
The biggest issue is that your GET URL on the FE is incorrect. Your server is running on localhost/ngrok, so to hit it you should take out the${process.env.SHOP}
in your URL. So the route should just be ->/admin/api/2022-10/products.json
.
You can see an example of this and get a better idea of how it works by going through the example app build that Shopify provides (https://shopify.dev/apps/getting-started/build-app-example (https://shopify.dev/apps/getting-started/build-app-example)).
It's important to note that these aren't Shopify specific concepts, so you should brush up on Express app routing a bit and how to hit your endpoints from your FE. Shopify abstracts a lot of things in their templates and it's easy to get confused where things are happening so taking time to read through the code and see what's going on will be super helpful going forward
Source
Didn't find the answer?
Our community is visited by hundreds of Shopify development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.