Skip to content

SeaCloudHub/backend

Repository files navigation

Template for go team

Development

Init local environment

  1. Copy file .env.example and rename to .env

  2. Update env vars to fit your local

  3. Start local services

    make db
  4. Run the migration

     make migrate
  5. Create admin account

    make seed
  6. Run the server

    make run
  7. Run the thumbnail service

    make thumbnail
  8. Unit test

    make test

Linting

make lint

Create new migration file

sql-migrate new -env="development" create-users-table
  • Result: Created migration migrations/20230908204301-create-users-table.sql

Swagger

  • Access to {host}/swagger/index.html

  • Install swag CLI

go install github.com/swaggo/swag/cmd/swag@latest
  • Generate swagger docs
make swagger