Open
Description
Description
Much of the code in the "learn" docs uses promise-based APIs:
graphql.github.io/src/pages/learn/execution.mdx
Lines 61 to 65 in b1215ce
This would be much easier to read in the more modern async/await code:
async function Query_human(obj, args, context, info) {
const userData = await context.db.loadHumanByID(args.id)
return new Human(userData)
}
Motivation
async/await has been around long enough now that this should be the norm, and is much easier to read and reason about. This will also help reduce the need to explain about promises in the documentation (though we will still need to note alternative techniques in other languages).
Collaboration
I do not currently have sufficient bandwidth to make these changes; but if they're not done in a year definitely ping me!
Additional Context
Inspired by @mandiwise's overhaul of the documentation.