Running your own GraphQL server
Originally my plan was to create a step-by-step guide to teach everyone how to set their own server up — but after a few beers one night I sort of wrote the whole thing without thinking twice about committing each step at a time.
- Clone this repo: https://github.com/rozenmd/graphql-resolvers
- Setup Terraform: https://maxrozen.com/2018-02-07-getting-started-with-terraform
- Setup your Amazon account according to the instructions in the repo
- Edit infrastructure/vars.tf, set up all of your variables
- Edit infrastructure/backend.tf, copy your Domain name to bucket and key, and copy your aws_region to region (variables don’t work in this one file)
- Run npm install or yarn in /api, then npm run build
- Change directory to /infrastructure, then run terraform init and terraform plan to see the new infrastructure to be created. If you’re happy with the changes, run terraform apply
- OPTIONAL: To tear down the infrastructure terraform has created, run terraform destroy
Note that it is normal to feel despair at how complicated GraphQL is — we’ve all felt it. I’ve spent months reading and thinking and coding GraphQL to get to the level of understanding I have now, so if you have any questions, tweet at me! @MxRozen
Originally published at maxrozen.com on February 21, 2018.