How to use the @adonisjs/cookie.serialize function in @adonisjs/cookie

To help you get started, we’ve selected a few @adonisjs/cookie examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github adonisjs / adonis-framework / packages / response / src / Response.ts View on Github external
public plainCookie (key: string, value: any, options?: Partial): this {
    if (options) {
      options = Object.assign({}, this._config.cookie, options)
    } else {
      options = this._config.cookie
    }

    const serialized = serialize(key, value, undefined, options)
    if (!serialized) {
      return this
    }

    this.append('set-cookie', serialized)
    return this
  }
github adonisjs / adonis-framework / packages / response / src / Response.ts View on Github external
public clearCookie (key: string, options?: Partial): this {
    if (options) {
      options = Object.assign({}, this._config.cookie, options)
    } else {
      options = this._config.cookie
    }

    options.expires = new Date(1)

    const serialized = serialize(key, '', undefined, options)
    if (!serialized) {
      return this
    }

    this.append('set-cookie', serialized)
    return this
  }
github adonisjs / adonis-framework / packages / response / src / Response.ts View on Github external
public cookie (key: string, value: any, options?: Partial): this {
    if (options) {
      options = Object.assign({}, this._config.cookie, options)
    } else {
      options = this._config.cookie
    }

    const serialized = serialize(key, value, this._secretKey, options)
    if (!serialized) {
      return this
    }

    this.append('set-cookie', serialized)
    return this
  }

@adonisjs/cookie

Cookie parser for AdonisJs framework

MIT
Latest version published 6 years ago

Package Health Score

61 / 100
Full package analysis

Popular @adonisjs/cookie functions