app.get("/api/single_a", verifyRequest, async (req, res) => {
try {
const sessionId = await shopify.session.getCurrentId({
rawRequest: req,
rawResponse: res,
});
const session = await sessionHandler.loadSession(sessionId);
const client = new shopify.clients.Rest({session});
const response = await client.get({
path: 'themes/id/assets',
query:{
asset:{
key: "assets/animations.js"
}
}
});
console.log("value", response.body.asset.value )
response.body.asset.value = "<p>Heloo world </p>"
console.log("value changed", response.body.asset.value )
await client.put({
path: `themes/id/assets`,
data: response.body.asset
});
console.log("Layout of theme liquid", response);
res.status(200).json({ response }); // Assuming you want to send themes as JSON
} catch (error) {
console.error("Error while fetching all Single Asset", error);
res.status(500).json({ error: "An error occurred while fetching Single Asset" });
}
});