go-service-template

module
v0.0.0-...-f4d84f6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2022 License: MIT

README

  1. get swagger https://goswagger.io/install.html

    # grab the image
    docker pull quay.io/goswagger/swagger
    
    # for mac and linux
    alias swagger='docker run --rm -it  --user $(id -u):$(id -g) -e GOPATH=$(go env GOPATH):/go -v $HOME:$HOME -w $(pwd) quay.io/goswagger/swagger' 
    
    
  2. build server api

    swagger generate server -A $APP_NAME -f ./schema/swagger.yml
    
    
  3. build client api

    swagger generate client -A $APP_NAME -f ./schema/swagger.yml
    
    
  4. install dependencies

    go get -u -f ./...
    
    
  5. run program

    make build && ./main --port=$APP_PORT
    or
    go run cmd/$APP_NAME-server/main.go --port=$APP_PORT
    
    
  6. build docker image

    cp .env.template .env
    make build-container
    
    
  7. run docker image

    make run-container
    
    
  8. delete docker container

    make stop-container
    
    
  9. run localhost

    make localhost
    
    

Second part:

Create environment for web3 development:

  1. docker-compose up -d --build or make dapp-build
  2. docker exec -it truffle sh -c cd init && truffle compile
  3. docker exec -it truffle sh -c cd init && truffle migrate --reset
  4. docker exec -it truffle sh -c cd init && npm run dev

Using ethereum/solc docker run -v $(pwd)/dapp/src/truffle:/sources ethereum/solc:stable -o /sources/election/output/contracts/ --abi --bin /sources/election/contracts/Election.sol

Directories

Path Synopsis
cmd
Package restapi Service API
Package restapi Service API
service
db
eth
log
rpc

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL