apollographql / apollographql/fullstack-tutorial

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

Open
#58 1 comment 0 reactions 0 assignees View on GitHub
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

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.