In the previous entries, I created the go-server configuration and the specifications. To generate the default router and controller, in my repo’s root directory, I enter openapi-generator-cli generate -c openapi/config/go-server.yaml. There are lot of files generated, and notice that there’s main.go. This is because you can treat this as an executable project already; it has default service/handler, controller, and router.
Example output:
── server
│ ├── gen
│ │ ├── Dockerfile
│ │ ├── README.md
│ │ ├── api
│ │ │ └── openapi.yaml
│ │ ├── go
│ │ │ ├── api.go
│ │ │ ├── api_default.go
│ │ │ ├── api_default_service.go
│ │ │ ├── error.go
│ │ │ ├── helpers.go
│ │ │ ├── impl.go
│ │ │ ├── logger.go
│ │ │ ├── model_journal_entry.go
│ │ │ ├── model_journal_entry_create.go
│ │ │ └── routers.go
│ │ ├── go.mod
│ │ └── main.go