是否可以在不使用cli的情况下使用放大框架? [英] Is it possible to use the amplify framework without using the cli?

查看:63
本文介绍了是否可以在不使用cli的情况下使用放大框架?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

放大常见问题解答明确指出您可以.但是github链接现在仅将您重定向到主放大页面,并且说明仅涉及使用cli.

The amplify FAQ says specifically you can. But the github links now just redirect you to the main amplify page and the instructions only talk about using the cli.

问:即使不使用CLI,也可以使用Amplify Framework库吗? 是的.这些库可用于访问在没有Amplify CLI的情况下创建的后端资源.

Q: Can I use the Amplify Framework libraries even if I do not use the CLI? Yes. The libraries can be used to access backend resources that were created without the Amplify CLI.

  • https://aws.amazon.com/amplify/faqs/
  • https://docs.aws.amazon.com/amplify/?id=docs_gateway
  • https://aws-amplify.github.io/docs/

推荐答案

我了解到,您无需Amplify CLI就可以使用Amplify库.

I have learned that you are able to use the amplify libraries without the Amplify CLI.

要执行此操作,您只需正常安装放大库即可.

To do this you simply install the amplify library as normal.

在React Web中:

In react web:

npm install --save aws-amplify
npm install --save aws-amplify-react

此后,您需要通过 Amplify.configure(); 手动配置要使用的所有功能.您可以在Amplify文档中找到打算使用的每个库的手动配置.

After that you need to manually configure any features you're going to use with Amplify.configure();. You can find the manual configuration in the Amplify documentation for each library you plan to use.

以下是使用Cognito的示例:

Here is an example using Cognito:

https://aws-amplify.github.io/docs/js/authentication#manual-setup

Amplify.configure({
    "aws_project_region": process.env.REACT_APP_REGION,
    "aws_cognito_identity_pool_id": process.env.REACT_APP_IDENTITY_POOL_ID,
    "aws_cognito_region": process.env.REACT_APP_REGION,
    "aws_user_pools_id": process.env.REACT_APP_USER_POOL_ID,
    "aws_user_pools_web_client_id": process.env.REACT_APP_CLIENT_ID,
    "oauth": {},
    Auth: {
        // REQUIRED - Amazon Cognito Identity Pool ID
        identityPoolId: process.env.REACT_APP_IDENTITY_POOL_ID,
        // REQUIRED - Amazon Cognito Region
        region: process.env.REACT_APP_REGION, 
        // OPTIONAL - Amazon Cognito User Pool ID
        userPoolId: process.env.REACT_APP_USER_POOL_ID, 
        // OPTIONAL - Amazon Cognito Web Client ID (26-char alphanumeric string)
        userPoolWebClientId: process.env.REACT_APP_CLIENT_ID,
    }
});

您无需使用放大按钮进行部署.您可以手动部署和配置正在使用的任何功能.

You do not have to use the amplify push for deployments. You can manually deploy and configure any features you're working with.

我发现这种方法使您可以完全控制Amplify库的使用,而不会增加CLI和部署过程的开销.

I find this approach gives you full control over using the Amplify library without the overhead of the CLI and deployment process.

这篇关于是否可以在不使用cli的情况下使用放大框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆