https://docs.nestjs.com/fundamentals/execution-context
http | graphql | |
---|---|---|
context | context.switchToHttp() | GqlExecutionContext.create(context).getContext() |
request | context.switchToHttp().getRequest() | GqlExecutionContext.create(context).getContext().req |
response | context.switchToHttp().getResponse() | GqlExecutionContext.create(context).getContext().res |
@UseInterceptors(LoggingInterceptor)
@RequestHeader()
- https://github.com/nestjs/nest/issues/4798@User()
- @UseGuards(AuthGuard)
이후의 user
가져오는@UseFilters(ExceptionFilter)
HTTP용과 GraphQL용을 구분해서 각각 만들어도 되고,
서로 다른 context의 출발점을 구분하여 하나로 만들어도 된다.
참고)