Skip to content

Commit c7630aa

Browse files
committed
update
1 parent 62c55c8 commit c7630aa

File tree

11 files changed

+120
-8
lines changed

11 files changed

+120
-8
lines changed

api/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,17 @@ eg:
201201

202202
* 参考 <https://developer.github.com/v3/#client-errors>
203203

204+
JSON 解析错误
205+
206+
```
207+
HTTP/1.1 400 Bad Request
208+
Content-Length: 35
209+
210+
{"message":"Problems parsing JSON"}
211+
```
212+
213+
参数错误
214+
204215
```
205216
HTTP/1.1 422 Unprocessable Entity
206217
Content-Length: 149

api/patch/del.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,5 @@ Authorization: Bearer <token>
5656
## example
5757

5858
```
59-
curl -H "Accept: application/vnd.greedlab+json" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE0NzIxODEyMzUxMzksImV4cCI6MTQ3NDc3MzIzNTEzOSwiaWQiOiI1N2JmOWJhMWNlODRjOTk5YTBlZmQ1YjciLCJzY29wZSI6ImRlZmF1bHQifQ.ESm0koiqDc8nfRTiHp4Uwo7PKNCtPRU5dfVfLT6MUSk" -X DELETE localhost:4002/patches/57bff6d74bf68967a8bb1b0f
59+
curl -H "Accept: application/vnd.greedlab+json" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE0NzIxODEyMzUxMzksImV4cCI6MTQ3NDc3MzIzNTEzOSwiaWQiOiI1N2JmOWJhMWNlODRjOTk5YTBlZmQ1YjciLCJzY29wZSI6ImRlZmF1bHQifQ.ESm0koiqDc8nfRTiHp4Uwo7PKNCtPRU5dfVfLT6MUSk" -X DELETE localhost:4002/patches/57c000dc648d87e9a9f9af23
6060
```

api/token/detail.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,5 @@ Authorization: Bearer <token>
8282
## example
8383

8484
```
85-
curl -H "Accept: application/vnd.greedlab+json" -H "Content-Type: application/json" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE0NzIxODEyMzUxMzksImV4cCI6MTQ3NDc3MzIzNTEzOSwiaWQiOiI1N2JmOWJhMWNlODRjOTk5YTBlZmQ1YjciLCJzY29wZSI6ImRlZmF1bHQifQ.ESm0koiqDc8nfRTiHp4Uwo7PKNCtPRU5dfVfLT6MUSk" -X POST -d '{"password": "secretpasas"}' localhost:4002/tokens/57c010d5a327e877acaef6a7
85+
curl -H "Accept: application/vnd.greedlab+json" -H "Content-Type: application/json" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE0NzIxODEyMzUxMzksImV4cCI6MTQ3NDc3MzIzNTEzOSwiaWQiOiI1N2JmOWJhMWNlODRjOTk5YTBlZmQ1YjciLCJzY29wZSI6ImRlZmF1bHQifQ.ESm0koiqDc8nfRTiHp4Uwo7PKNCtPRU5dfVfLT6MUSk" -X POST -d '{"password": "secretpasas"}' localhost:4002/tokens/57c016c88d082a7fad7c35d4
8686
```

api/user/login.md

+21-1
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,38 @@ POST
5656
| 状态码 | 说明 | 备注 |
5757
| --- | --- | --- |
5858
| 401 | 用户名或密码错误 | |
59+
| 422 | 用户名或密码不能为空 | |
5960
| 500 | 服务器内部错误 | |
6061

6162
### 出错返回数据实例
6263

64+
401
65+
66+
```json
67+
{
68+
"message": "Email or password error"
69+
}
70+
```
71+
72+
422
73+
6374
```json
6475
{
65-
"message": "用户名或密码错误"
76+
"message": "Email is empty",
77+
"errors": [
78+
{
79+
"resource": "User",
80+
"field": "email",
81+
"code": "missing_field"
82+
}
83+
]
6684
}
6785
```
6886

6987
## example
7088

7189
```
7290
curl -H "Accept: application/vnd.greedlab+json" -H "Content-Type: application/json" -X POST -d '{ "email": "[email protected]", "password": "secretpasas" }' localhost:4002/login
91+
92+
curl -H "Accept: application/vnd.greedlab+json" -H "Content-Type: application/json" -X POST -d '{ "email": "[email protected]", "password": "new_password" }' localhost:4002/login
7393
```

api/user/register.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,21 @@ POST
5454

5555
| 状态码 | 说明 | 备注 |
5656
| --- | --- | --- |
57-
| 400 | 邮箱或密码格式错误 | |
58-
| 422 | 邮箱已存在 | |
57+
| 422 | 邮箱/密码格式错误/邮箱已存在 | |
5958
| 500 | 服务器内部错误 | |
6059

6160
### 失败返回数据实例
6261

6362
```json
6463
{
65-
"message": "用户已存在"
64+
"message": "User is existed",
65+
"errors": [
66+
{
67+
"resource": "User",
68+
"field": "email",
69+
"code": "already_exists"
70+
}
71+
]
6672
}
6773
```
6874

api/user/reset-password.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ POST
4848

4949
| 状态码 | 状态信息 | 说明 | 备注 |
5050
| --- | --- | --- | --- |
51-
| 400 | 邮箱不能为空/邮箱格式错误 | | |
52-
| 422 | 账号不存在/重置密码邮件发送失败 | | |
51+
| 422 | 账号不存在/重置密码邮件发送失败/邮箱不能为空/邮箱格式错误 | | |
5352
| 500 | 服务器内部错误 | | |
5453

5554
### 失败返回数据实例

front/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# 前端模板引擎结构

front/user/login.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# 登录
2+
3+
## URI
4+
5+
```
6+
/login
7+
```
8+
9+
## 结构
10+
11+
| key | 说明 |
12+
| --- | --- |
13+
| error | 错误提示 |
14+
| email | 邮箱 |
15+
| email_error | 邮箱错误提示 |
16+
| password | 密码 |
17+
| password_error | 密码错误提示 |

front/user/register.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# 注册
2+
3+
## URI
4+
5+
```
6+
/register
7+
```
8+
9+
## 结构
10+
11+
| key | 说明 | 备注 |
12+
| --- | --- | --- |
13+
| error | 错误提示 | |
14+
| email | 邮箱 | |
15+
| email_error | 邮箱错误提示 | |
16+
| email_autofocus | 光标聚焦在邮箱 | autofocus 或者 空 |
17+
| password | 密码 | |
18+
| password_error | 密码错误提示 | |
19+
| password_autofocus | 光标聚焦在邮箱密码 | autofocus 或者 空 |
20+
| confirm_password | 密码校验 | |
21+
| confirm_password_error | 密码校验错误提示 | |
22+
| confirm_password_autofocus | 光标聚焦在邮箱密码校验 | autofocus 或者 空 |

front/user/reset-password.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# 重置密码
2+
3+
## URI
4+
5+
```
6+
/reset-password
7+
```
8+
9+
## 结构
10+
11+
| key | 说明 | 备注 |
12+
| --- | --- | --- |
13+
| success | 成功提示 | |
14+
| error | 错误提示 | |
15+
| email | 邮箱 | |
16+
| email_error | 邮箱错误提示 | |
17+
| email_autofocus | 光标聚焦在邮箱 | autofocus 或者 空 |

front/user/set-my-password.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# 设置我的密码
2+
3+
## URI
4+
5+
```
6+
/set-my-password
7+
```
8+
9+
## 结构
10+
11+
| key | 说明 |
12+
| --- | --- |
13+
| error | 错误提示 |
14+
| email | 用户名 |
15+
| email_error | 用户名错误提示 |
16+
| password | 密码 |
17+
| password_error | 密码错误提示 |
18+
| confirm_password | 密码 |
19+
| confirm_password_error | 密码错误提示 |

0 commit comments

Comments
 (0)