DEV Community

David Hwang
David Hwang

Posted on

5/19 TIL: gqlgen: go graphql lib

  • go mod init command creates a go.mod file to track our code's dependencies
    • go mod init {module path} ex. github.com/{username}/gqlgen-todos
  • gqlgen
    • after installing gqlgen, doing a go run (http://github.com/99designs/gqlgen) init will create a graphql structure based on the suggested package layout
    • schema is defined in schema.graphql
    • doing gqlgen generate compares the schema files with the models and bind wherever it can directly to the model
    • implement a field in Resolver.go to track our state and add logic to the resolver methods
    • go run server.go to start
  • https://gqlgen.com/getting-started/

Top comments (0)