Hi so I’m a beginner in shopify, I’ve been working on some shopify sites for about 2 months in frontend, and I don’t have any senior that can help me with this, so here it is we have this certain APP in our shop installed and we decided that we don’t want to use their widget and instead we’ll use their API to customize it.
Now I have successfully created a standalone node.js script with the help of axios and express to get the data we wanted but I’m wondering how am I supposed to use the script I created on my Shopify store? do I need to create a custom app using node js and use the script I wrote in there? at this point, I’m lost and don’t know what to do next, hope someone could help me understand things with this, thank you!
here’s the standalone node js simple project I’ve created
const PORT = 8000
const axios = require('axios')
const express = require('express')
const app = express()
app.get('/results', function(req, res) {
axios({
method: "GET",
url: "https://api-of-the-app-we-are-using",
data: {
shop_domain: "sample.myshopify.com",
api_token: "sampletoken",
external_id: 111,
},
})
.then((response) => {
let product = response.data.product;
return axios({
method: "GET",
url: "https://api-of-the-app-we-are-using",
data: {
shop_domain: "sample.myshopify.com",
api_token: "sampletoken",
product_id: product.id,
},
});
})
.then((response) => {
res.json(response.data)
})
.catch((error) => console.log(error));
})
app.listen(PORT, () => console.log(`server running on PORT ${PORT}`))
note: I can’t use the regular AJAX and FETCH API of my .liquid because of the 3rd party app I’m using forbids it so I need to use node.js to fetch raw data from their server