apollographql / apollographql/fullstack-tutorial

[Question]Why are no `async` on some resolver methods?

オープン
#58 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
1.2k
フォーク
808
PR マージ指標
30日以内にマージされた PR はありません

説明

Hi, I'm very new to Apollo graphql and reading through the tutorial.
I noticed that `launch` method in resolver.js does not have `async` and wondering why even though the request is asynchronous. In fact, if I add async it works as expected. Could someone tell me why `async` is not required in this case?

```
module.exports = {
Query: {
launches: async (_, __, { dataSources }) =>
dataSources.launchAPI.getAllLaunches(),
launch: (_, { id }, { dataSources }) => // no async
dataSources.launchAPI.getLaunchById({ launchId: id }),
me: async (_, __, { dataSources }) =>
dataSources.userAPI.findOrCreateUser(),
},
};
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

resolver.js と issue に示されている Query resolver から始め、続いて launches および me メソッドと併せて dataSources.launchAPI.getLaunchById を調べます。launch resolver が async なしで書かれている理由を文書化し、チュートリアルの読者にとって説明が明確になるようにします。チュートリアルの文脈で async に関する疑問に答えられれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, node.js
領域
documentation
issue の種類
ドキュメント
難易度
1/5
見積もり時間
1時間未満
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。