Licence
MIT
Version
1.0.0
Deps
1
Size
8 kB
Vulns
1
Weekly
0
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);
}