A simple Graphql Go HTTP server boilerplate. This boilerplate project can be fully customized to your needs.
Thanks to VSCode and Go, we can have a fully intellisense when coding. It come with .vscode/extensions.json
for recommended extensions.
- Download and install Go
- Run the command
go get -u
to install dependencies - (Opt) Install Air if you want ☁️ Live reload
# install air via go commannd
$ go get -u github.com/cosmtrek/air
- Copy
.env.example
to new env file.env
and fill the environment variables
# Application (development, production)
ENV=development
PORT=8080
SECRET_KEY="5cR3t_K37"
# Gorm Credential
GORM_LOGMODE=true
GORM_DIALECT=postgres
GORM_CONNECTION_DSN="postgres://username:password@localhost:port/database"
# run server and visit localhost:8080 for graphql playground
$ go run main.go
# or run live reload go via air and visit localhost:8080
$ air -d
- [] TODO
- [] TODO
# generate dataloader file if you are using one
$ dataloaden UserLoader int *github.com/my/app/model.User
# -or-
$ go run github.com/vektah/dataloaden UserLoader int *github.com/my/app/model.User
# run command everything you're changing the Graphql Schema file *.gql
$ gqlgen generate
$ go run github.com/99designs/gqlgen
# clean your project dependencies
$ go get tidy
# running unit test
$ go test -timeout 30s -coverprofile=c.out ./... && go tool cover -html=c.out
$ goconvey