mirror of
https://github.com/wahyd4/libr-2.git
synced 2026-08-09 05:15:53 +10:00
#1 update api readme
This commit is contained in:
@@ -112,22 +112,74 @@
|
||||
}
|
||||
```
|
||||
|
||||
5 follow 用户:POST http://localhost:3000/api/v1/users/2/follow
|
||||
5 关注follow 用户:POST http://localhost:3000/api/v1/users/2/follow
|
||||
|
||||
6 unfollow 用户: POST: http://localhost:3000/api/v1/users/2/unfollow
|
||||
6 取消关注unfollow 用户: POST: http://localhost:3000/api/v1/users/2/unfollow
|
||||
|
||||
7 like post POST: http://localhost:3000/api/v1/posts/3/like
|
||||
7 喜欢 post POST: http://localhost:3000/api/v1/posts/3/like
|
||||
|
||||
- 返回结果
|
||||
``` json
|
||||
{
|
||||
"msg": "done",
|
||||
"likes_count": 1
|
||||
}
|
||||
```
|
||||
|
||||
8 unlike post POST: http://localhost:3000/api/v1/posts/3/unlike
|
||||
8 取消喜欢 post POST: http://localhost:3000/api/v1/posts/3/unlike
|
||||
|
||||
9 create comment POST: http://localhost:3000/api/v1/posts/1/comments
|
||||
9 创建评论 POST: http://localhost:3000/api/v1/posts/1/comments
|
||||
|
||||
10 comment list GET http://localhost:3000/api/v1/posts/1/comments
|
||||
- 参数
|
||||
* content
|
||||
- 返回结果
|
||||
``` json
|
||||
{
|
||||
"msg": "done",
|
||||
"comments_count": 3
|
||||
}
|
||||
```
|
||||
|
||||
11 like comment: POST http://localhost:3000/api/v1/posts/1/comments/1/like
|
||||
10 评论列表 GET http://localhost:3000/api/v1/posts/1/comments
|
||||
|
||||
12 unlike comment: POST http://localhost:3000/api/v1/posts/1/comments/1/unlike
|
||||
- 返回结果:
|
||||
``` json
|
||||
[
|
||||
{
|
||||
"content": "这篇文章写得很深入,很好",
|
||||
"likes_count": 0,
|
||||
"user": "test",
|
||||
"time": "2015-08-12T22:00:27.556+08:00"
|
||||
},
|
||||
{
|
||||
"content": "太长了,不太好读",
|
||||
"likes_count": 1,
|
||||
"user": "test",
|
||||
"time": "2015-08-12T22:00:42.356+08:00"
|
||||
},
|
||||
{
|
||||
"content": "太长了,不太好读",
|
||||
"likes_count": 0,
|
||||
"user": "test",
|
||||
"time": "2015-08-16T22:48:39.099+08:00"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
11 喜欢评论 comment: POST http://localhost:3000/api/v1/posts/1/comments/1/like
|
||||
|
||||
- 返回结果:
|
||||
```json
|
||||
{
|
||||
"msg": "done",
|
||||
"likes_count": 1
|
||||
}
|
||||
```
|
||||
|
||||
12 取消喜欢评论 comment: POST http://localhost:3000/api/v1/posts/1/comments/1/unlike
|
||||
|
||||
#### 注意
|
||||
* 注意,API返回结果中的token是利用JWT 技术加密的token,密钥是每个用户的email
|
||||
* [jwt](http://jwt.io/)
|
||||
* 通常执行创建(POST) 操作时,如果没有返回结果,仅仅返回200,也是成功的表示, 当返回400时即为失败
|
||||
|
||||
|
||||
Reference in New Issue
Block a user