GithubHelp home page GithubHelp logo

auth_apis's Introduction

Api practice -- login service

Start project

  1. initial
    sudo docker-compose up -d
  2. do migration
    sudo docker-compose exec app go run main.go migrate up
  3. copy config
    cp config.yml.example config.yml
  • refresh code
    sudo docker-compose restart app
  • refresh swagger
    sudo docker-compose exec app swag init
  • Run test (since integration tests, refresh db not set parallel 1 will crash)
    go test -p 1 ./...

Tools

  • Jaeger UI
    http://localhost:16686
  • Swagger
    http://localhost:666/swagger/index.html

Commands

  • ./main serve
  • ./main work:email
  • ./main migrate up
  • ./main migrate refresh
  • ./main migrate down [steps, default all]
  • ./main migrate make [make params]

About Migrate

  • migrate from local
    ./cmd/migrate.linux-amd64 -database "postgres://postgres:fortestpwd@localhost:45487/auth?sslmode=disable" -verbose -path db/migrations up
  • migrate in container
    sudo docker-compose exec app go run main.go migrate up

generate key and secret

  1. Generate private key
    ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
  2. Generate public key
    openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
  3. Setting
    copy and paste to config.yml

Q&A

  • migration failed (fix and force version)
    run drop table schema_migrations; in db

auth_apis's People

Contributors

deanxu2357 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.