ExecutionContext

오픈소스·2024년 6월 28일
0

https://docs.nestjs.com/fundamentals/execution-context

  • ExecutionContext
    • HTTP
      • GraphQL: GqlExecutionContext
    • RPC
    • WebSocket
httpgraphql
contextcontext.switchToHttp()GqlExecutionContext.create(context).getContext()
requestcontext.switchToHttp().getRequest()GqlExecutionContext.create(context).getContext().req
responsecontext.switchToHttp().getResponse()GqlExecutionContext.create(context).getContext().res

HTTP용과 GraphQL용을 구분해서 각각 만들어도 되고,
서로 다른 context의 출발점을 구분하여 하나로 만들어도 된다.

참고)

0개의 댓글