在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):boazdejong/serverless-graphql-api开源软件地址(OpenSource Url):https://github.com/boazdejong/serverless-graphql-api开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):Serverless GraphQL API using Lambda and DynamoDBGraphQL Lambda Server using graphql-server-lambda from Apollo. graphql-tools and merge-graphql-schemas are used to generate the schema. serverless-webpack is used to transform ES6 with Babel and build the lambda. SetupClone the repository and install the packages.
DeployRun the
Queries and MutationsQuery the GraphQL server using the GraphiQL.app. If you have Homebrew installed on OSX run
MutationsThe following mutations are available in this example. createArtist()Create an artist providing the first and last name as arguments. The id will be a generated uuid. mutation {
createArtist(first_name: "Billy", last_name: "Crash") {
id
}
} createSong()Using the generated id from the artist you can create a song with the following mutation. Also provide a title and duration. mutation {
createSong(artist: "99a746e0-0734-11e7-b2fd-45ae0a3b9074", title: "Whatever", duration: 120) {
id
}
} updateArtist()mutation {
updateArtist(id: "99a746e0-0734-11e7-b2fd-45ae0a3b9074", first_name: "John", last_name: "Ruth") {
id
first_name
last_name
}
} updateSong()mutation {
updateSong(id: "a8a0a060-071b-11e7-bd09-8562f101f7c2", artist: "99a746e0-0734-11e7-b2fd-45ae0a3b9074", duration: 130, title: "A new title") {
id
}
} QueriesExample query{
songs {
id
title
duration
artist {
id
first_name
last_name
}
}
} This query will return a result similar to this {
"data": {
"songs": [
{
"id": "a8a0a060-071b-11e7-bd09-8562f101f7c2",
"title": "Whatever",
"duration": 120,
"artist": {
"id": "99a746e0-0734-11e7-b2fd-45ae0a3b9074",
"first_name": "Billy",
"last_name": "Crash"
}
}
]
}
} DynamoDB StreamsThis project also includes an example of capturing table activity with DynamoDB Streams.
The In
The stream is enabled when defining the DynamoDB table in the
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论