Setu-TS
    Preparing search index...

    Function getSession

    • Returns the session the middleware loaded for this request.

      Parameters

      Returns ISession

      The session for this request

      If SessionPlugin is not registered

      If the session middleware did not run

      app.router.post('/cart', (ctx) => {
      const session = getSession(ctx);
      session.set('cartId', 'c-123');
      return ctx.response.json({ ok: true });
      });
      // Reaching the session from a React Router loader (Milestone 44):
      ReactRouterPlugin({
      build,
      populateLoadContext: (ctx, context) => {
      context.set(sessionContext, getSession(ctx));
      },
      });

      0.2.0