## Directory Structure ```text . ├── etc ├── cmd ├── queue ├── generate ├── initialize ├── go.mod ├── internal │ ├── config │ ├── handler │ ├── middleware │ ├── logic │ ├── svc │ ├── types │ └── model ├── scheduler ├── pkg └── script ``` - apis: API definition files - etc: Directory for static configuration files - cmd:Application entry point - queue:Queue consumption service - generate:Code generation tools - initialize: Initialization system configuration - internal:Internal modules - config:Configuration file parsing - handler:HTTP interface handling, with `handler` as the fixed suffix - middleware:HTTP middleware - logic:Business logic handling, with `logic` as the fixed suffix - svc:Service layer encapsulation - types:Type definitions - model:Data models - scheduler:Scheduled tasks - pkg: Common utility code - script:Build scripts ##### Generate Code ```bash $ chmod +x script/generate.sh $ ./script/generate.sh ``` ##### Generate Swagger ```bash $ goctl api plugin -plugin goctl-swagger='swagger -filename ppanel.json -pack Response -response "[{\"name\":\"code\",\"type\":\"integer\",\"description\":\"状态码\"},{\"name\":\"msg\",\"type\":\"string\",\"description\":\"消息\"},{\"name\":\"data\",\"type\":\"object\",\"description\":\"数据\",\"is_data\":true}]";' -api ppanel.api -dir . ``` ##### Format API File ```bash $ goctl api format --dir api/user.api ``` ##### Build ```bash $ go build -o ppanel ppanel.go ``` ##### Run ```bash $ ./ppanel run --config etc/ppanel.yaml ```