-
-
Notifications
You must be signed in to change notification settings - Fork 579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include working example of running a server #2373
Comments
I agree: we should definitely have fully working examples in the docs! Please could you explain how the examples on the usage page fall short of this desire? Since you're interested in contributing - please feel free to raise pull requests directly against that page using the "Edit this page" link on the page ❤ (As an additional resource, check out ouch-my-finger which is mostly used for debugging) |
Thanks so much, I really appreciate the work that you do, and for getting back so quickly. The challenges that I faced were finding the correct combination of pgl.js contents, graphile.config.mjs (or graphile.config.ts), and example-node.js vs example-express.js. In addition, I had to find the correct npm modules to import. So it may be as easy as creating a section in the documentation dedicated to a simple working example. I would be happy to put that into a PR. Having the example in the code repository may also be helpful. Maybe something like: A Simple Working Express Application Example With Three FilesCreate and Initialize a Project: mkdir postgraphile_v5_node_express_example
cd postgraphile_v5_node_express_example
npm init -y
npm install -D @tsconfig/node20 @types/express @types/node typescript
npm install express postgraphile@beta The Three filesThe three files in this example are
|
Really really valuable commentary; thanks! Please go ahead and make the changes that you see fit on whichever pages make sense to do so. You may also want to check on the quick start guide. V5 documentation is still very much work in progress, and some of it is probably even wrong due to API changes having happened since the original docs were written - I'll definitely be going over it carefully when V5 hits release candidate status, but for now I'm relying on folks like yourself to help keep it correct by spotting and fixing errors and ideally monitoring the changelogs for breaking changes and making sure the documentation is updated. I'm currently focussed on #2060 which is humongous (multi-month project) and am trying to stay focused to keep moving us towards RC status 🚀 |
Also: taking notes like you have done above in issues when something is non obvious is the absolute best thing to do. It's very hard to figure out why you were confused once something makes sense, best to share early that you're confused and then track your progress so that the docs can be improved for future readers - exactly as you have done! 🙌 |
Let's leave this open until the docs have been improved; don't want to lose track of your valuable content! |
Thanks, I'll work on a PR this evening |
PR has been created, it has examples for both JavaScript and TypeScript, I believe that the steps to create working servers with the two approaches are complete. The updates have the complete contents of the JavaScript files, TypeScript files, .env, package.json, and tsconfig.js. |
Feature description
It would be great if the documentation had a working example of running a server
Here is an example:
Create a simple node project and install packages
mkdir postgraphile_v5_node_example cd postgraphile_v5_node_example npm init -y npm install -D @tsconfig/node20 @types/express @types/node typescript npm install express postgraphile@beta
Add start script to package.json
Create or modify tsconfig.json to
Create a simple server in typescript
Create index.ts with these contents
Run from command line and open GraphiQL UI
Open browser and navigate to http://localhost:5050 to view the GraphiQL UI
Motivating example
Could not find any working examples in documentation
Breaking changes
None
Supporting development
The text was updated successfully, but these errors were encountered: