This example uses micro service framework and graphql. The demonstrates sql operations for a user such as insertion, deletion, update, and query. In addition, the example includes an example for security check before calling graphql. Using this template, one can quickly develop a backend server.
-
Config
.netrc
so that you can pull private go repoCopy
.netrc.example
to create your own.netrc
and place it at the same place as.netrc.example
so that the docker-compose is able to pull the private repo. Also, copy your created.netrc
to~/.netrc
so that your IDE such asgoland
will be able to pull the go mode private repo. Alternative way to allow your IDE to pull go mod private repo is to config the git by enabling ssh-key authentication. You first let git to replace thehttps
url withgit
by running.git config --global url."ssh://[email protected]/secure-for-ai/".insteadOf "https://github.com/secure-for-ai/"
Then,
go mod download
will be able to pull the private repo if ssh-key is correctly configured. -
Setup the environment
GOPRIVATE=github.com/secure-for-ai
in IDE such as goland so that we can pull our private package directly instead of pulling through the proxy, which is the default pulling. -
Start docker compose
docker-compose up
-
Initial Mongo
# login mongo mongo --port 27017 --host=localhost --authenticationDatabase=admin \ -p password --username test
# setup replication with single master rs.initiate({_id: "rs0", members: [{_id: 0, host: "localhost:27017"}] })