RequestContextService
Creates new RequestContext instances.
create
method
(config: { req?: Request; apiType: ApiType; channelOrToken?: Channel | string; languageCode?: LanguageCode; currencyCode?: CurrencyCode; user?: User; activeOrderId?: ID; }) => Promise<RequestContext>v1.5.0Creates a RequestContext based on the config provided. This can be useful when interacting with services outside the request-response cycle, for example in stand-alone scripts or in worker jobs.
fromRequest
method
(req: Request, info?: GraphQLResolveInfo, requiredPermissions?: Permission[], session?: CachedSession) => Promise<RequestContext>Creates a new RequestContext based on an Express request object. This is used internally in the API layer by the AuthGuard, and creates the RequestContext which is then passed to all resolvers & controllers.
Was this chapter helpful?