Nestjs 获取cookie

Docs

yarn add cookie-parser

main.ts

import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import * as cookieParser from 'cookie-parser' async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.use(cookieParser());
await app.listen(5000);
}
bootstrap();
  @Get('json')
json(@Request() req){
l(req.cookies)
}
上一篇:简明python教程 --C++程序员的视角(六):输入输出IO


下一篇:IO(六)--- 编码和解码