对于我的下一个项目,我想在前端使用 Graphql。此外,这个项目还应该提供一个 Rest-Api。现在我发现了这个非常伟大的框架“nestjs”,理论上可以将 Graphql 端点和 Rest 端点结合起来。不幸的是,如果这会导致问题,我在文档中找不到任何内容。下面的代码可以正常使用吗?
阿蒂克尔控制器:
@Controller('article')
@Resolver('Article')
export class ArticleController {
constructor(private articleService: ArticleService){}
@Get()
@Query(returns => CArticle)
async Article() {
const dbElement=await this.articleService.getById("xy");
return dbElement;
}
}
Run Code Online (Sandbox Code Playgroud)
文章模块:
@Module({
controllers:[ArticleController],
providers:[ArticleService,ArticleController]
})
export class ArticleModule {}
Run Code Online (Sandbox Code Playgroud) 在我的反应原生应用程序中,我为用户提供了使用 Facebook 按钮登录的可能性。为此,我使用 Amplify,它在 Cognito 中应该在用户池中创建一个用户。这也有效,但由于某种原因它并不总是有效。我也无法解释它,因为我不使用可能包含我的网站错误的触发器。大约 40% 的情况下无法登录。以下操作会导致错误:
结果:现在用户池中没有创建用户,并且react-native应用程序中出现以下错误(通过Hub.listen("auth"):
{"event":"signIn_failure","data":{},"message":"The OAuth response flow failed"}
console.js:35
{"event":"signIn_failure","data":{},"message":"The OAuth response flow failed"}
console.js:35
{"event":"cognitoHostedUI_failure","data":{},"message":"A failure occurred when returning to the Cognito Hosted UI"}
console.js:35
{"event":"cognitoHostedUI_failure","data":{},"message":"A failure occurred when returning to the Cognito Hosted UI"}
console.js:35
{"event":"customState_failure","data":{},"message":"A failure occurred when returning state"}
console.js:35
{"event":"customState_failure","data":{},"message":"A failure occurred when returning state"}
Run Code Online (Sandbox Code Playgroud)
我的应用程序客户端设置如下所示: