How can I resolve issues with Shopify Node and React App development?

FaizaBashir
Shopify Partner
38 0 2

Hello, i am working on a test shopify app with node and react. I checked the documentation and thas about admin side. I am working in fromt end store side. Right now i have an issue getting current session or shop url and access token. Also I am not sure in which files i should write the code or call apis. For now i added a file in middlewares where i have logic to add script tag and i include that file in index.js. Is that the right way? Also when i call any api in middleware.file.js if i give relative path "/api/someapi" i get invalide url error. I have One more question, i have js file that is included through script tags that saves data in localStorage on button click. Now i want to save that data to database. I have seccefully connected to database. Can you please guide me How and n wihich files Iwhere should i write code to save that data to database?

I tried this ode for getting access token and i wrote this in index.js 

const buildAccessTokenRequestUrl = (shop) => {return `https://${shop}/admin/oauth/access_token`};
const fetchAccessToken = async (shop, data) => await axios(buildAccessTokenRequestUrl(shop), {
  method: 'POST',
  data
});
console.log(fetchAccessToken)
i get this in console
[AsyncFunction: fetchAccessToken]
Am i missing something?

Thank you.

Edit: I think what i am looking for is Theme app extension.

Replies 0 (0)