AWS Appsync $ctx vs $context in resolvers

时间:2019-03-19 14:58:47

标签: amazon-web-services graphql aws-appsync appsync-apollo-client aws-appsync-ios

I understand that context is what ever name you define in your Lambda functions but when it comes to Appsync resolvers I'm a bit confused. I've seen both $ctx and $context being used in AppSync resolvers including in AWS docs. Some of AWS's own code generation tools like AWS Amplify CLI create resolvers that use both in the same code! I can't find anything in the docs explaining this. What's going on here?

1 个答案:

答案 0 :(得分:3)

(此处为AWS AppSync开发人员)

AWS AppSync中的

$ctx$context指的是同一Resolver Context。我们添加了$ctx作为$context的别名,以减少用户必须输入的字符数({$ctx$context短50%!)

选择$context$ctx是个人喜好。在编写AWS AppSync解析器时,我更喜欢$ctx

相关问题