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.{username}/gqlgen-todos
  • gqlgen
    • after installing gqlgen, doing a go run ( 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

Discussion (0)