title: Koa server-- How to pass data in the server between middlewares so I can pass it to the front end
body: <p>In my server, I have the following set up to grab the current logged-in user data:</p>
  <pre><code>  const server = new Koa();
    const router = new Router();
    server.keys = [Shopify.Context.API_SECRET_KEY];
    server.use(
      createShopifyAuth({
        async afterAuth(ctx) {
          // Access token and shop available in ctx.state.shopify
          const { shop, accessToken, scope } = ctx.state.shopify;
  
    const client = new Shopify.Clients.Rest(shop, accessToken);
          const data = await client.get({
            path: 'users/current',
          });
  </code></pre>
  <p>I am correctly getting the data but I would like to pass it to the front end.
  I've tried storing the data in a global variable, I've tried storing the data in app.context and I've tried storing the data in ctx.state.</p>
  <p>My idea is that I'd be able to grab the data and place it in the following so that I can make a fetch request to this /user endpoint:</p>
  <pre><code>router.get('/user', (ctx,next) =&gt; {
    next();
    console.log('check for ctx.state: ', ctx.state);
  })
    
  </code></pre>
  <p>At the end of the day, I need access to the shop and accessToken from the Auth function which is why I'd need to pass the data instead of making the data request in the router.get function.
  I haven't worked with Koa before so any help would be greatly appreciated. Thank you!</p>