Skip to content

Latest commit

 

History

History
45 lines (37 loc) · 1.71 KB

Readme.md

File metadata and controls

45 lines (37 loc) · 1.71 KB

Micro Service Example

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.

How to run

  • Config .netrc so that you can pull private go repo

    Copy .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 as goland 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 the https url with git 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"}] })