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?
答案 0 :(得分:3)
(此处为AWS AppSync开发人员)
AWS AppSync中的 $ctx
和$context
指的是同一Resolver Context。我们添加了$ctx
作为$context
的别名,以减少用户必须输入的字符数({$ctx
比$context
短50%!)
选择$context
或$ctx
是个人喜好。在编写AWS AppSync解析器时,我更喜欢$ctx
。