your recipe card header background

    Create Cookie Session

    0

    0

    Jose Romero

    Remix JavaScript public recipes

    Create a cookie session with remix.

    Library: remix

    Shortcut: remix.cookie.session

    import { createCookieSessionStorage } from "remix";
    
    const sessionSecret = "YOURSESSIONSECRET";
    const { getSession, commitSession, destroySession } =
      createCookieSessionStorage({
        // a Cookie from `createCookie` or the CookieOptions to create one
        cookie: {
          name: "__session",
          // all of these are optional
          domain: "domain.tld",
          expires: new Date(Date.now() + 60),
          httpOnly: true,
          maxAge: 60,
          path: "/",
          sameSite: "lax",
          secrets: [sessionSecret],
          secure: true
        }
      });
    export { getSession, commitSession, destroySession };
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.