在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):dabit3/graphql-api-cdk-serverless-postgres开源软件地址(OpenSource Url):https://github.com/dabit3/graphql-api-cdk-serverless-postgres开源编程语言(OpenSource Language):TypeScript 49.6%开源软件介绍(OpenSource Introduction):CDK API with GraphQL and Aurora Serverless PostgreSQLThis CDK stack deploys a real-time GraphQL API built with AWS AppSync, Amazon Aurora Serverless PostgreSQL, and AWS Lambda. Getting startedTo deploy this project, follow these steps.
git clone https://github.com/dabit3/graphql-api-cdk-serverless-postgres.git
cd graphql-api-cdk-serverless-postgres
npm install
cd lambda-fns
npm install
cd ..
npm run build
cdk deploy --O cdk-exports.json
Visit the RDS dashboard and click on Query Editor. From the dropdown menu, choose the database (it should begin with appsynccdkrdsstack-aurorablogcluster). For the Database username, choose Connect with a Secrets Manager ARN. To sign in, you will need the ARN from the secret that was created by CDK. To get this secret, in a new window open AWS Secrets manager. Here, click on the secret that was created by CDK (it should start with AuroraBlogClusterSecret). Copy the Secret ARN to your clipboard and go back to the RDS Query Editor. Next, use the Secret ARN as the Secrets Manager ARN and BlogDB as the name of the database. Next, press enter and click on Connect to Database. Once signed in, create the posts table by executing the following query: CREATE TABLE posts (
id text UNIQUE,
title text,
content text
);
Next, visit the AppSync console and click on cdk-blog-appsync-api to view the dashboard for your API. Next click on Queries in the left hand menu to view the query editor. From here, we can test out the API by running the following queries and mutations: mutation createPost {
createPost(post: {
id: "001"
title: "My first post!"
content: "Hello world!"
}) {
id
title
content
}
}
query listPosts {
listPosts {
id
title
content
}
}
query getPostById {
getPostById(postId: "001") {
id
title
content
}
}
mutation updatePost {
updatePost(post: {
id: "001"
title: "My updated post!"
}) {
id
title
}
}
mutation deletePost {
deletePost(postId: "001")
} |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论