apollographql / apollographql/fullstack-tutorial
[Question]Why are no `async` on some resolver methods?
- Lingua principale
- TypeScript
- Stelle
- 1.2k
- Fork
- 808
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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(),
},
};
```
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia con resolver.js e i resolver Query mostrati nell’issue, quindi esamina dataSources.launchAPI.getLaunchById insieme ai metodi launches e me. Documenta il motivo per cui il resolver di launch è scritto senza async e rendi chiara la spiegazione per i lettori del tutorial; il lavoro è completato quando la domanda su async ha una risposta nel contesto del tutorial.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, node.js
- Ambito
- documentation
- Tipo di issue
- Documentazione
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 35/100