Interface CookieOptions

Options passed down into res.cookie

interface CookieOptions {
    domain?: string;
    encode?: Object;
    expires?: Date;
    httpOnly?: boolean;
    maxAge?: number;
    partitioned?: boolean;
    path?: string;
    priority?: "high" | "low" | "medium";
    sameSite?: boolean | "none" | "strict" | "lax";
    secure?: boolean;
    signed?: boolean;
}

Properties

domain?: string

Domain name for the cookie. Defaults to the domain name of the app.

encode?: Object

A synchronous function used for cookie value encoding. Defaults to encodeURIComponent.

expires?: Date

Expiry date of the cookie in GMT. If not specified or set to 0, creates a session cookie.

httpOnly?: boolean

Flags the cookie to be accessible only by the web server.

maxAge?: number

Convenient option for setting the expiry time relative to the current time in milliseconds.

partitioned?: boolean

Marks the cookie to use partioned storage.

path?: string

Path for the cookie. Defaults to “/”.

priority?: "high" | "low" | "medium"

Value of the “Priority” Set-Cookie attribute.

sameSite?: boolean | "none" | "strict" | "lax"

Value of the “SameSite” Set-Cookie attribute.

secure?: boolean

Marks the cookie to be used with HTTPS only.

signed?: boolean

Indicates if the cookie should be signed.