Simple skeleton for a Go GraphQL API connected to a Postgres database.
- Go v1.11
brew install go
- Postgres v11
brew install postgresql
Build Go module:
go build ./...
Start the GraphQL server:
go run server/server.go
Try some operations:
query sayHello {
hello(id:"1")
}
db.go
- Database setup and connectionmodel.go
- Application type definitionsresolver.go
- Resolve API operations, with access to databaseschema.graphql
- GraphQL schema in SDLserver/server.go
- Serve GraphQL APIutil/schema.go
- Transform SDL to parseable string