Skip to content

akorzunin/richmond-api

Repository files navigation

richmond-api

Backend for richmond app from https://github.com/Lokrand/richmond

Run dev server at localhost:8080

go run main.go

build binary

go build -o ./build/richmond-api

Run tests

go install github.com/rakyll/gotest@latest
gotest ./... -v

Run DB and s3 in docker

AUTH_USER=admin AUTH_PASS=admin docker compose -f ./deploy/compose.yaml up -d rustfs postgres

OpenAPI Docs

Install Dependencies

go mod download
go install github.com/swaggo/swag/v2/cmd/swag@latest
go install github.com/air-verse/air@latest
go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
go install github.com/pressly/goose/v3/cmd/goose@latest

After adding/modifying endpoints, regenerate the OpenAPI spec:

swag init --parseDependency --parseInternal

This generates:

  • docs/swagger.json - OpenAPI 3.1 spec
  • docs/docs.go - Go bindings (don't edit manually)

Docs at: http://localhost:8080/swagger/index.html

Migrations ans sqlc

Generate sqlc

sqlc generate

Run migrations locally

GOOSE_DRIVER=postgres GOOSE_DBSTRING=postgres://admin:admin@localhost:9903/main GOOSE_MIGRATION_DIR=./internal/db/schema goose up

Run migrations on host

GOOSE_DRIVER=postgres GOOSE_DBSTRING=postgres://${AUTH_USER}:${AUTH_PASS}@localhost:9903/main GOOSE_MIGRATION_DIR=./internal/db/schema ~/go/bin/goose up

License

MIT

About

Backend for richmond app from https://github.com/Lokrand/richmond

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors