bra*_*rke 3 node.js typescript graphql nestjs typegraphql
如何访问传递@Res()到我的 graphql 解析器?
这不起作用:
@Mutation(() => String)
login(@Args('loginInput') loginInput: LoginInput, @Res() res: Response) {
return this.authService.login(loginInput, res);
}
Run Code Online (Sandbox Code Playgroud)
@Res()用于 HTTP 请求。要访问res对象,您需要首先确保context通过context: ({ req, res }) => ({ req, res })在GraphqlModule's 选项中使用将其添加到for graphql ,然后您可以使用它@Context() ctx来获取上下文并ctx.res获取响应对象
| 归档时间: |
|
| 查看次数: |
267 次 |
| 最近记录: |