This is a project starter for fiber apps
This you can use the temaple button to create a new repo or you can use degit.
$ npx degit https://github.com/Xavier577/fiber-boilerplate.git <project-name>
$ go mod tidy
$ go run main.go
.
├── LICENSE
├── README.md
├── config
│ └── env
│ └── env.go
├── dbconf.yml
├── docs
│ ├── docs.go
│ ├── swagger.json
│ └── swagger.yaml
├── go.mod
├── go.sum
├── main.go
├── migrations
│ └── 20230809154912_dbinit.sql
├── pkg
│ └── number
│ └── number.go
└── users
├── handler.go
└── route.go
- docs: generated by swag for api documentation
- migrations: contains migrations for the postgres (Goose was used to generate and run the migration files but the migrations are handwritten)
- dbconf.yml: config file for goose
Generate swagger docs with Swag
To generate swagger docs for your APIs with swag, run:
$ swag init -g main.go
Migrations with Goose
You can create migrations in either go or sql. SQL is preferred in this project. To generate migrations with in SQL with goose, run:
$ goose -path . create <your-migration-name>
$ goose -path . up -env <environment> # (check dbconf.yml to see configured environments)
$ goose -path . down -env <environment> # (check dbconf.yml to see configured environments)