ppanel-server/readme.md
2025-09-27 10:17:16 +08:00

71 lines
1.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## 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
- cmdApplication entry point
- queueQueue consumption service
- generateCode generation tools
- initialize: Initialization system configuration
- internalInternal modules
- configConfiguration file parsing
- handlerHTTP interface handling, with `handler` as the fixed suffix
- middlewareHTTP middleware
- logicBusiness logic handling, with `logic` as the fixed suffix
- svcService layer encapsulation
- typesType definitions
- modelData models
- schedulerScheduled tasks
- pkg Common utility code
- scriptBuild 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
```