简体   繁体   English

在 React js 中使用现有的 aws amplify 项目

[英]Using existing aws amplify project in react js

I use AWS amplify with auth, dynamodb and graphql API for react native app.我将 AWS amplify 与 auth、dynamodb 和 graphql API 一起用于反应原生应用程序。 Now I need to add the existing backend to web react js app.现在我需要将现有的后端添加到 web react js app。 I run the command below and get amplify backend folder with API, auth, and functions.我运行下面的命令并使用 API、auth 和函数获取放大后端文件夹。 There is a missing graphql folder (GraphQL client ) for queries and mutations.缺少用于查询和突变的 graphql 文件夹(GraphQL 客户端)。 How to get GraphQL client folder for fetching data from db?如何获取 GraphQL 客户端文件夹以从数据库中获取数据?

amplify pull --appId someidgoeshere --envName dev

Copying folder (src/graphql->mutation.js,queries.js,subscription.js) from an existing project works well.从现有项目复制文件夹(src/graphql->mutation.js、queries.js、subscription.js)效果很好。 If there is a better solution I would love to try it.如果有更好的解决方案,我很乐意尝试。

You can also use amplify api gql-compile to re-compile your src/graphql/* queries and mutations.您还可以使用amplify api gql-compile重新编译您的src/graphql/*查询和突变。

https://docs.amplify.aws/cli/graphql-transformer/overview#update-schema https://docs.amplify.aws/cli/graphql-transformer/overview#update-schema

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM