This project aims to use graph-gophers/graphql-go to build a GraphQL API server.
- Integrated with pg
- Database migrations
- Integrated with graphql-go
- Use go-bindata to generate Go code from .graphql file
- Add authentication & authorization
- Add simple unit test cases
- Postgres database
- Golang
- GNU Make (Optional)
-
Create database in Postgres and update server.toml configuration and run migrations
make migrate
-
Install go-bindata
go get -u github.com/go-bindata/go-bindata/...
-
Run the following command at root directory to generate Go code from .graphql file
make schema
There would be bindata.go generated under
schema
folder -
Start the server (Ensure your postgres database is live and its setting in server.toml is correct)
make run
-
Build docker image. Update config/server.toml configuration file before building image. Make sure server http ports match in config and Dockerfile. Also update postgres configuration.
make build-docker
-
Run docker image
make run-docker
Run Unit Tests
make test
Test coverage
make coverage