mirror of
https://github.com/wahyd4/libr-2.git
synced 2026-08-09 05:15:53 +10:00
temp remove dockerfile
This commit is contained in:
@@ -42,30 +42,30 @@ bundle exec sidekiq -C config/sidekiq.yml
|
||||
|
||||
1 注册 POST: http://127.0.0.1:3000/api/v1/sign_up
|
||||
|
||||
- 参数:
|
||||
* user[email]
|
||||
* user[password]
|
||||
* user[password_confirmation]
|
||||
- 返回结果
|
||||
|
||||
```json
|
||||
{
|
||||
"user": {
|
||||
"id": 10,
|
||||
"name": "test5",
|
||||
"email": "test5@qq.com",
|
||||
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbiI6ImU3M2YzYTljMTIxMjVkNDViNjJlNjkxNjQ4MjgyNGVmIn0.Rv_DkYEDWOIhObnTjC_8N8L-BACm8cFCOSqEgSmPUDc"
|
||||
- 参数:
|
||||
* user[email]
|
||||
* user[password]
|
||||
* user[password_confirmation]
|
||||
- 返回结果
|
||||
|
||||
```json
|
||||
{
|
||||
"user": {
|
||||
"id": 10,
|
||||
"name": "test5",
|
||||
"email": "test5@qq.com",
|
||||
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbiI6ImU3M2YzYTljMTIxMjVkNDViNjJlNjkxNjQ4MjgyNGVmIn0.Rv_DkYEDWOIhObnTjC_8N8L-BACm8cFCOSqEgSmPUDc"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
```
|
||||
|
||||
2 登录 POST: http://127.0.0.1:3000/api/v1/sign_in
|
||||
- 参数:
|
||||
- 参数:
|
||||
* user[email]
|
||||
* user[password]
|
||||
- 返回结果:
|
||||
|
||||
```json
|
||||
- 返回结果:
|
||||
|
||||
```json
|
||||
{
|
||||
"user": {
|
||||
"id": 3,
|
||||
@@ -74,16 +74,16 @@ bundle exec sidekiq -C config/sidekiq.yml
|
||||
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbiI6IjU0MGU4OTU4ODg3ZmI1MGI5YTA5YzI4MjQ2NTZlYTRlIn0.XQBWCNRYVdDvZwuBtafCyOkNpP8FEzwRqk8AhaHlaFc"
|
||||
}
|
||||
}
|
||||
```
|
||||
```
|
||||
|
||||
3 提交分享资源 POST: http://localhost:3000/api/v1/posts
|
||||
- 参数
|
||||
- 参数
|
||||
* 需要登录 传Authorization header
|
||||
* url 网址
|
||||
* type article 或者 page
|
||||
* description 可选
|
||||
- 返回
|
||||
|
||||
- 返回
|
||||
|
||||
``` json
|
||||
{
|
||||
"id": 32,
|
||||
@@ -253,33 +253,33 @@ bundle exec sidekiq -C config/sidekiq.yml
|
||||
|
||||
15 获取最受欢迎的文章 GET http://localhost:3000/api/v1/top
|
||||
|
||||
- 参数
|
||||
* 无
|
||||
|
||||
- 返回结果
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"viewed_times": 3,
|
||||
"url": "https://github.com/strongloop/express",
|
||||
"title": "strongloop/express · GitHub",
|
||||
"type": "web_pages",
|
||||
"processed": true,
|
||||
"good_format": false,
|
||||
"created_at": "2015-08-07T00:33:27.420+08:00"
|
||||
},
|
||||
{
|
||||
"viewed_times": 0,
|
||||
"url": "https://github.com/sparklemotion/mechanize",
|
||||
"title": "sparklemotion/mechanize · GitHub",
|
||||
"type": "posts",
|
||||
"processed": true,
|
||||
"good_format": false,
|
||||
"created_at": "2015-08-07T00:25:56.942+08:00"
|
||||
}
|
||||
]
|
||||
```
|
||||
- 参数
|
||||
* 无
|
||||
|
||||
- 返回结果
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"viewed_times": 3,
|
||||
"url": "https://github.com/strongloop/express",
|
||||
"title": "strongloop/express · GitHub",
|
||||
"type": "web_pages",
|
||||
"processed": true,
|
||||
"good_format": false,
|
||||
"created_at": "2015-08-07T00:33:27.420+08:00"
|
||||
},
|
||||
{
|
||||
"viewed_times": 0,
|
||||
"url": "https://github.com/sparklemotion/mechanize",
|
||||
"title": "sparklemotion/mechanize · GitHub",
|
||||
"type": "posts",
|
||||
"processed": true,
|
||||
"good_format": false,
|
||||
"created_at": "2015-08-07T00:25:56.942+08:00"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
#### 注意
|
||||
* 注意,API返回结果中的token是利用JWT 技术加密的token,密钥是每个用户的email
|
||||
|
||||
@@ -1,2 +1,8 @@
|
||||
class Api::V1::UsersController < ApplicationController
|
||||
class Api::V1::UsersController < Api::V1::ApplicationController
|
||||
|
||||
|
||||
def show
|
||||
render json: @current_user
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
class UserSerializer < ActiveModel::Serializer
|
||||
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user