How to get current session and access token in node js and Shopify app

205 Views Asked by At

I created a test node js and react shopify app. I am new to shopif app development. I created Theme app extension and successfully added test blocks to theme. What I want to achieve is add a button to theme that when clicked save data to database. I have done this through script tags by hardcoding shop url and access token. I have 2 questions.

  1. How to get shop url and access token and current session in backend ( Middlewares, helpers, index.js)
  2. How do I use database to save data to database with Theme app extensions. I mean in which files i should work if anyone can share a tutorial or link. I am attaching my directory structure. Please guide me I am not sure which files i should work. Right now I have a file in middlewares that has script tags code that i include in index.js. Is that the right way? I tried many solutions from internet but noting seems to work. Thanks Directory structure](https://i.stack.imgur.com/cZ95K.png)
0

There are 0 best solutions below