- Spin up MongoDB docker container:
$ docker volume create mongo-data $ docker network create htv-net $ docker run -d --network htv-net -p 27017:27017 -v mongo-data:/data/db --name mongodb -e MONGO_INITDB_ROOT_USERNAME=admin -e MONGO_INITDB_ROOT_PASSWORD=password --restart always mongo
- Spin up Redis docker container:
$ docker volume create redis-data $ docker run --name redis --restart always -d -p 6379:6379 --network htv-net -v redis-data:/data redis redis-server --appendonly yes
- Install and configure Golang for your OS: Here
- Clone this repository master branch
cd
into the project root- Run the following commands to download the dependencies,
verify them and vendor it locally for your projects:
$ go mod download $ go mod tidy $ go mod verify $ go mod vendor
- Set the following environment variables for the MLH Oauth middleware:
export client_id=some_id export client_secret=some_secret export scope=email+education+birthday export redirect_uri=http://localhost:8080/v1/auth/callback
- Run the following command to start up the graphql playground:
$ go run ./server/server.go
- Modify
resolver.go
as you go along to add/modify features. - Now on your frontend, redirect the user to the following url to initiate the flow
(provided you have addedhttp://localhost:8080/v1/auth/callback
to the redirect url section for your mlh client id)https://my.mlh.io/oauth/authorize?client_id=some_client_id&redirect_uri=http://localhost:8080/v1/auth/callback&response_type=code&scope=email+education+birthday
- For more information on how gqlgen works, check out the: docs