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