apollographql / apollographql/fullstack-tutorial
[Question]Why are no `async` on some resolver methods?
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 808
- PR merge metrics
- No merged PRs in 30d
Description
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(),
},
};
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with resolver.js and the Query resolvers shown in the issue, then inspect dataSources.launchAPI.getLaunchById alongside the launches and me methods. Document the reason the launch resolver is written without async and make the explanation clear for tutorial readers; done means the async question is answered in the tutorial context.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100