我们可以通过以下步骤来考察AppSync和Apollo GraphQL的性能表现:
aws appsync create-graphql-api \
--name myapi \
--authentication-type API_KEY \
--region us-west-2 \
--profile my-profile \
--output json \
--no-cli-pager \
--query graphqlApi.id
aws appsync create-type \
--api-id your_api_id \
--definition file://schema.graphql \
--profile your_aws_cli_profile \
--region your_region \
--type-name Query \
--format SDL \
--output json \
--no-cli-pager \
--query type.id
const server = new ApolloServer({
typeDefs, // your type definitions
resolvers, // your resolvers
context: ({ req}) => {
// any additional context
return {};
},
playground: true,
});
type Query {
getBooks: [Book]! @http(
url: "http://your-apollo-server-address/graphql"
method: "GET"
)
}
通过上述步骤, 我们可以比较AppSync和Apollo GraphQL在各自领域内的性能。同时,我们还应注意到,性能优先级的设置应与具体的应用场景相关,不应一概而论。
上一篇:Appsync与ApiGateway的缓存 { message: '内部服务器错误' }
下一篇:AppSync与DynamoDB:无效的KeyConditionExpression:属性名是保留关键字;保留关键字:name”