# CookiesParams Decorator operation input
Module | import { CookiesParams } from "@tsed/common" |
---|---|
Source | /packages/common/src/mvc/decorators/params/cookies.ts |
# Overview
function CookiesParams(expression: string | any, useType: any): ParameterDecorator;
export function CookiesParams(): ParameterDecorator;
export function CookiesParams(expression: string | any): ParameterDecorator;
export function CookiesParams(options: IParamOptions<any>): ParameterDecorator;
Param | Type | Description |
---|---|---|
expression | string | any | The path of the property to get. useType |
# Description
Cookies or CookiesParams return the value from request.cookies object.
# Example
@Controller('/')
class MyCtrl {
@Post('/')
create(@Cookies() cookies: any) {
console.log('Entire cookies', cookies);
}
@Post('/')
create(@Cookies('id') id: string) {
console.log('ID', id);
}
@Post('/')
create(@Cookies('user') user: IUser) {
console.log('user', user);
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
For more information on deserialization see converters page.
- Session & cookies
- Passport.js
- TypeORM
- Mongoose
- GraphQL
- Socket.io
- Swagger
- AJV
- Multer
- Serve static files
- Templating
- Throw HTTP Exceptions
- Customize 404
- AWS
- Jest
- Seq
- Controllers
- Providers
- Model
- Converters
- Middlewares
- Pipes
- Interceptors
- Authentication
- Hooks
- Injection scopes
- Custom providers
- Custom endpoint decorator
- Testing