Skip to content

Recommended structures for Nirvana projects #318

@supereagle

Description

@supereagle

Is this a BUG REPORT or FEATURE REQUEST?:

Uncomment only one, leave it on its own line:

/kind bug
/kind feature

What happened:

We did discuss this before, the proposed (slightly modified) structure is:

.                                   #
├── Gopkg.toml                      #
├── Makefile                        #
├── README.md                       # 
├── apis                            # 存放 apidocs (swagger json)
│   ├── api.v1.json                 #
│   └── api.v2.json                 #
├── bin                             # 存放编译后的二进制文件
│   └── nirvana-myproject           #
├── build                           # 存放 Dockerfile
│   └── nirvana-myproject           #
│       └── Dockerfile              #
├── cmd                             # 存放项目的启动命令
│   └── nirvana-myproject           #
│       └── main.go                 #
├── nirvana.yaml                    #
├── pkg                             # 存放 api 需要用到的结构体与相应的 converters, 按版本区分
│   ├── apis                        #
│   │   └── v1                      #
│   │       ├── converters          #
│   │       │   └── converters.go   #
│   │       └── types.go            #
│   │       ├── descriptors          #
│   │           ├── descriptors.go      #
│   │           └── message.go          # 对应 message 业务逻辑的 API 定义
│   ├── filters                     # 存放 HTTP Request 过滤器
│   │   └── filter.go               #
│   ├── handler                     # 存放 API 需要用到的逻辑处理
│   │   └── message.go              #
│   ├── middlewares                 # 存放中间件
│   │   └── middlewares.go          #
│   ├── modifiers                   # 存放 Definition 修改器
│   │   └── modifiers.go            #
│   └── version                     # 项目版本信息目录
│       └── version.go              #
└── vendor        

Refer to the discussion for details.

What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions