Skip to content

Commit

Permalink
update Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
bughou committed Jul 12, 2020
1 parent a51a01c commit 085f1e0
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# goa
a golang http router with regexp support, inspired by `httprouter` and `gin`.
a golang http router with regexp support and document generation.

[![Build Status](https://travis-ci.org/lovego/goa.svg?branch=master)](https://travis-ci.org/lovego/goa)
[![Coverage Status](https://img.shields.io/coveralls/github/lovego/goa/master.svg)](https://coveralls.io/github/lovego/goa?branch=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/lovego/goa?1)](https://goreportcard.com/report/github.com/lovego/goa)
[![GoDoc](https://godoc.org/github.com/lovego/goa?status.svg)](https://godoc.org/github.com/lovego/goa)

## document generation
see [example](docs/z_test.go) and [the generated documents](docs/testdata/README.md).

## default middlewares
- logging with error alarm support
- list of requests in processing
Expand Down
1 change: 0 additions & 1 deletion docs/.gitignore

This file was deleted.

6 changes: 6 additions & 0 deletions docs/testdata/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## 账号
###  [用户 (/users)](users/README.md)
###  [公司 (/companies)](companies/README.md)
## [商品 (/goods)](goods/README.md)
## [单据 (/bill)](bill/README.md)
## [库存 (/storage)](storage/README.md)
3 changes: 3 additions & 0 deletions docs/testdata/bill/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 单据 (/bill)
采购、销售

1 change: 1 addition & 0 deletions docs/testdata/companies/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# 公司 (/companies)
1 change: 1 addition & 0 deletions docs/testdata/goods/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# 商品 (/goods)
1 change: 1 addition & 0 deletions docs/testdata/storage/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# 库存 (/storage)
21 changes: 21 additions & 0 deletions docs/testdata/users/(?P<type>\w+)/GET_(?P<id>\d+).md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 用户详情 : GET /users/(?P&lt;type&gt;\w+)/(?P&lt;id&gt;\d+)
获取用户的详细信息

## 路径中正则参数(子表达式)说明
- type (string): 类型
- id (int): ID

## 返回头说明
- Set-Cookie: 返回登录会话

## 返回体说明(application/json)
```json5
{
"code": "", # ok表示成功,其他表示错误代码
"message": "", # 与code对应的描述信息
"data": { # 返回的数据
"Id": 0, # ID
"Name": "" # 名称
}
}
```
35 changes: 35 additions & 0 deletions docs/testdata/users/GET.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 用户列表 : GET /users
列出所有的用户

## Query参数说明
- page (int): 页码
- type (string): 类型
- id (int): ID
- flag (bool): 标志

## 请求头说明
- Cookie (string): Cookie中包含会话信息

## 请求体说明(application/json)
```json5
{
"Name": "", # 名称
"Type": "", # 类型
"Id": 0, # ID
"Flag": false # 标志
}
```

## 返回体说明(application/json)
```json5
{
"code": "", # ok表示成功,其他表示错误代码
"message": "", # 与code对应的描述信息
"data": [ # 返回的数据
{
"Id": 0, # ID
"Name": "" # 名称
}
]
}
```
3 changes: 3 additions & 0 deletions docs/testdata/users/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 用户 (/users)
###  [用户列表 : GET /users](GET.md)
###  [用户详情 : GET /users/(?P&lt;type&gt;\w+)/(?P&lt;id&gt;\d+)](%28%3FP%3Ctype%3E%5Cw+%29/GET_%28%3FP%3Cid%3E%5Cd+%29.md)

0 comments on commit 085f1e0

Please sign in to comment.