1.0.0 • Published 2 years ago

nestjs-cookie v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

NestJS Cookie

Initialize a new Typescript project for Node

Install

npm install nestjs-cookie
# or
yarn add nestjs-cookie

Usage

Use the @Cookie decorator to grab a cookie from the cookie header.

import { Cookie } from 'nestjs-cookie';

@Get()
async myMethod(@Cookie('some_token') token: string) {
  console.log(token);
}

You can also grab a Map of all cookies using the @Cookies decorator

import { Cookies } from 'nestjs-cookie';

@Get()
async myMethod(@Cookies() cookies: Map<string, string>) {
  console.log(cookies);
}