Skip to content

Commit

Permalink
docs: update references to old fastify-* modules (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs authored Apr 29, 2022
1 parent 9bf09e4 commit 47eb70d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# fastify-cookie
# @fastify/cookie

![CI](https://github.com/fastify/fastify-cookie/workflows/CI/badge.svg)
[![NPM version](https://img.shields.io/npm/v/fastify-cookie.svg?style=flat)](https://www.npmjs.com/package/fastify-cookie)
[![NPM version](https://img.shields.io/npm/v/@fastify/cookie.svg?style=flat)](https://www.npmjs.com/package/@fastify/cookie)
[![Known Vulnerabilities](https://snyk.io/test/github/fastify/fastify-cookie/badge.svg)](https://snyk.io/test/github/fastify/fastify-cookie)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://standardjs.com/)

Expand All @@ -12,16 +12,16 @@ This plugin's cookie parsing works via Fastify's `onRequest` hook. Therefore,
you should register it prior to any other `onRequest` hooks that will depend
upon this plugin's actions.

`fastify-cookie` [v2.x](https://github.com/fastify/fastify-cookie/tree/v2.x)
`@fastify/cookie` [v2.x](https://github.com/fastify/fastify-cookie/tree/v2.x)
supports both Fastify@1 and Fastify@2.
`fastify-cookie` v3 only supports Fastify@2.
`@fastify/cookie` v3 only supports Fastify@2.

## Example

```js
const fastify = require('fastify')()

fastify.register(require('fastify-cookie'), {
fastify.register(require('@fastify/cookie'), {
secret: "my-secret", // for cookies signature
parseOptions: {} // options for parsing cookies
})
Expand All @@ -47,8 +47,8 @@ fastify.get('/', (req, reply) => {
## TypeScript Example

```ts
import { FastifyCookieOptions } from 'fastify-cookie'
import cookie from 'fastify-cookie'
import { FastifyCookieOptions } from '@fastify/cookie'
import cookie from '@fastify/cookie'
import fastify from 'fastify'

const app = fastify()
Expand Down Expand Up @@ -126,7 +126,7 @@ Key rotation is when an encryption key is retired and replaced by generating a n

**Example:**
```js
fastify.register(require('fastify-cookie'), {
fastify.register(require('@fastify/cookie'), {
secret: [key1, key2]
})
```
Expand Down Expand Up @@ -161,7 +161,7 @@ The `secret` option optionally accepts an object with `sign` and `unsign` functi

**Example:**
```js
fastify.register(require('fastify-cookie'), {
fastify.register(require('@fastify/cookie'), {
secret: {
sign: (value) => {
// sign using custom logic
Expand All @@ -188,7 +188,7 @@ the provided signer's (or the default signer if no custom implementation is prov
**Example:**

```js
fastify.register(require('fastify-cookie'), { secret: 'my-secret' })
fastify.register(require('@fastify/cookie'), { secret: 'my-secret' })

fastify.get('/', (req, rep) => {
if (fastify.unsign(req.cookie.foo).valid === false) {
Expand Down

0 comments on commit 47eb70d

Please sign in to comment.