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
.netrcso that you can pull private go repoCopy
.netrc.exampleto create your own.netrcand place it at the same place as.netrc.exampleso that the docker-compose is able to pull the private repo. Also, copy your created.netrcto~/.netrcso that your IDE such asgolandwill 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 thehttpsurl withgitby running.git config --global url."ssh://git@github.com/secure-for-ai/".insteadOf "https://github.com/secure-for-ai/"
Then,
go mod downloadwill be able to pull the private repo if ssh-key is correctly configured. -
Setup the environment
GOPRIVATE=github.com/secure-for-aiin 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"}] })