You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!
And the way that you should use graphql-http per their doc is like this:
importexpressfrom'express';// yarn add expressimport{createHandler}from'graphql-http/lib/use/express';import{schema}from'./previous-step';// Create an express instance serving all methods on `/graphql`// where the GraphQL over HTTP express request handler isconstapp=express();app.all('/graphql',createHandler({ schema }));app.listen({port: 4000});console.log('Listening to port 4000');
Note that the current doc is broken and cannot be run without issue.
BTW to just communicate it clearly. Now I am questioning whether I should read your doc or not. I mean usually I tend to read docs all the time when I start something new. But at this rate I feel what I'll learn from your doc will be something that someone back in 2018 would have learned. Not to mention the NodeJS now is at version 22. While in your doc it is talking about examples being compatible with version 6. I am not sure except some old code bases if anybody else uses Node V6.
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:
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.
The text was updated successfully, but these errors were encountered: