Class Cookie

Constructors

  • Create a new Cookie

    Parameters

    • value: Content
    • Optional data: CookieData

    Returns Cookie

    Example

    import { Cookie } from "rjweb-server"

    const cookie = new Cookie('value', {
    expires: 50000
    })

    Since

    9.0.0

Properties

domain: null | string

The Domain this Cookie will be assigned to.

If not provided will not be used in the Cookie Header.

expires: null | number | Date

The Date or seconds in which the Cookie will expire

If not provided will create a "Session Cookie".

httpOnly: boolean

Whether the Cookie should be HTTP only

path: string

The Path under which to save the Cookie

sameSite: false | "none" | "strict" | "lax"

The SameSite Attribute of the Cookie

secure: boolean

Whether the Cookie should be Secure (HTTPS only)

value: Content

The Value of the Cookie