基础URL:http://localhost:3000
参数名称 |
是否必选 |
参数说明 |
nickName |
是 |
用户昵称 |
email |
是 |
邮件地址 |
password |
是 |
登录密码 |
role |
是 |
角色 [admin 超级管理员] [normal 普通用户] |
avatar |
否 |
头像 |
status |
是 |
状态 [0 未激活] [1 激活] |
{
"_id": "6231fc8a875361a58cd8691b", // 用户id
"email": "[email protected]", // 邮箱地址
"nickName": "Vogadero", // 昵称
"role": "admin", // 角色
"avatar": null, // 头像
"createTime": {
"$date": "2022-03-16T15:04:42.872Z"
}, // 创建时间
"status": 1 // 状态
}
参数名称 |
是否必选 |
参数说明 |
email |
是 |
邮箱地址 |
password |
是 |
登录密码 |
{
"nickName": "Vogadero",
"email": "[email protected]",
"password": "$2b$10$1eOkBNZRW8n3NfkmDxCsZu7vC/t7RDisd/WByDx.C6GhLGsVXkcaS",
"role": "admin",
"avatar": null,
"createTime": {
"$date": "2022-03-16T15:04:42.872Z"
},
"status": 1
}
请求地址 |
请求方式 |
/login/status |
GET |
var isLogin = true;
var userId = "5c8d0bd652ae3d26686b8601";
[
{
"role": "admin",
"avatar": null,
"status": 1,
"_id": "6231fc8a875361a58cd8691b",
"nickName": "Vogadero",
"email": "[email protected]",
"createTime": "2022-03-16T15:04:42.872Z"
}
]
{
"role": "admin",
"avatar": null,
"status": 1,
"_id": "6231fc8a875361a58cd8691b",
"nickName": "Vogadero",
"email": "[email protected]",
"createTime": "2022-03-16T15:04:42.872Z"
}
参数名称 |
是否必选 |
参数说明 |
nickName |
是 |
用户昵称 |
status |
否 |
用户状态 |
role |
否 |
用户角色 |
avatar |
否 |
用户头像 |
{
"role": "admin",
"avatar": null,
"status": 1,
"_id": "6231fc8a875361a58cd8691b",
"nickName": "Vogadero",
"email": "[email protected]",
"createTime": "2022-03-16T15:04:42.872Z"
}
请求地址 |
请求方式 |
说明 |
/users/:id |
DELETE |
批量删除,多个id用-隔开,例如:/users/:id-id-id |
{
"role": "admin",
"avatar": null,
"status": 1,
"_id": "6231fc8a875361a58cd8691b",
"nickName": "Vogadero",
"password":"$2b$10$1eOkBNZRW8n3NfkmDxCsZu7vC/t7RDisd/WByDx.C6GhLGsVXkcaS",
"email": "[email protected]",
"createTime": "2022-03-16T15:04:42.872Z"
}
[
{
"role": "admin",
"avatar": null,
"status": 1,
"_id": "6231fc8a875361a58cd8691b",
"nickName": "Vogadero",
"password":"$2b$10$1eOkBNZRW8n3NfkmDxCsZu7vC/t7RDisd/WByDx.C6GhLGsVXkcaS",
"email": "[email protected]",
"createTime": "2022-03-16T15:04:42.872Z"
}
]
请求地址 |
请求方式 |
/users/password |
PUT |
参数名称 |
是否必选 |
参数说明 |
userPass |
是 |
原密码 |
newPass |
是 |
新密码 |
confirmPass |
是 |
确认新密码 |
请求地址 |
请求方式 |
/categories |
POST |
参数名称 |
是否必选 |
参数说明 |
title |
是 |
分类名称 |
className |
是 |
分类图标类名 |
{
"className": "fa-car",
"_id": "6239dfae7daef8ded4720e19",
"title": "在路上",
"createAt": "2022-03-22T14:39:42.890+00:00"
}
请求地址 |
请求方式 |
/categories/:id |
GET |
{
"className": "fa-car",
"_id": "6239dfae7daef8ded4720e19",
"title": "在路上",
"createAt": "2022-03-22T14:39:42.890+00:00"
}
请求地址 |
请求方式 |
/categories |
GET |
[
{
"className": "fa-car",
"_id": "6239dfae7daef8ded4720e19",
"title": "在路上",
"createAt": "2022-03-22T14:39:42.890+00:00"
},
{
"className": "fa-cloud",
"_id": "6239e2a37daef8ded4720e1c",
"title": "阿里云",
"createAt": "2022-03-22T14:52:19.775+00:00"
}
]
请求地址 |
请求方式 |
/categories/count |
GET |
请求地址 |
请求方式 |
/categories/:id |
PUT |
参数名称 |
是否必选 |
参数说明 |
title |
否 |
分类名称 |
className |
否 |
分类图标类名 |
{
"className": "fa-car",
"_id": "6239dfae7daef8ded4720e19",
"title": "在路上",
"createAt": "2022-03-22T14:39:42.890+00:00"
}
请求地址 |
请求方式 |
说明 |
/categories/:id |
DELETE |
批量删除,多个id用-隔开,例如:/categories/:id-id-id |
{
"className": "fa-car",
"_id": "6239dfae7daef8ded4720e19",
"title": "在路上",
"createAt": "2022-03-22T14:39:42.890+00:00"
}
[
{
"className": "fa-car",
"_id": "6239dfae7daef8ded4720e19",
"title": "在路上",
"createAt": "2022-03-22T14:39:42.890+00:00"
}
]
参数名称 |
是否必选 |
参数说明 |
title |
是 |
文章标题 |
state |
是 |
文章状态 [0 草稿] [1 发布] |
content |
是 |
文章内容 |
category |
是 |
文章所属分类 |
thumbnail |
否 |
文章封面 |
createAt |
是 |
文章发布时间 |
{
"meta": {
"views": 0,
"likes": 0,
"comments": 0
},
"state": 1,
"content": "测试内容",
"thumbnail": "\\uploads\\upload_ac37048704b9a9624f15017debe70932.jpg",
"_id": "623d7baa00b63554ddbf9a99",
"title": "测试文章",
"category": "623ad94f2117f699fb85bb6c",
"author": "6231fc8a875361a58cd8691b",
"createAt": "2022-03-25T08:21:00.000Z",
"updateAt": "2022-03-25T08:22:02.600Z"
}
{
"meta": {
"views": 0,
"likes": 0,
"comments": 0
},
"state": 1,
"content": "测试内容",
"thumbnail": "\\uploads\\upload_ac37048704b9a9624f15017debe70932.jpg",
"_id": "623d7baa00b63554ddbf9a99",
"title": "测试文章",
"category": "623ad94f2117f699fb85bb6c",
"author": "6231fc8a875361a58cd8691b",
"createAt": "2022-03-25T08:21:00.000Z",
"updateAt": "2022-03-25T08:22:02.600Z"
}
参数名称 |
是否必选 |
参数说明 |
category |
否 |
文章所属分类 |
state |
否 |
文章状态 [0 草稿] [1 发布] |
page |
否 |
文章页码 |
{
"page": 1,
"size": 10,
"total": 4,
"records": [
{
"state": 1,
"thumbnail": "\\uploads\\upload_ac37048704b9a9624f15017debe70932.jpg",
"_id": "623d7baa00b63554ddbf9a99",
"title": "测试文章",
"category": {
"className": "fa-cloud",
"_id": "623ad94f2117f699fb85bb6c",
"title": "阿里云",
"createAt": "2022-03-25T08:21:00.000Z"
},
"author": {
"role": "admin",
"avatar": "\\uploads\\upload_125e963dc59d8535cdbb8b4fb72044d3.jpg",
"status": 1,
"_id": "6231fc8a875361a58cd8691b",
"nickName": "Vogadero",
"email": "[email protected]",
"createTime": "2022-03-16T15:04:42.872Z"
},
"createAt": "2022-03-25T08:21:00.000Z",
"updateAt": "2022-03-25T08:22:02.600Z"
}
],
"pages": 1,
"display": [
1
]
}
请求地址 |
请求方式 |
/posts/category/:id |
GET |
[
{
"meta": {
"views": 0,
"likes": 0,
"comments": 0
},
"state": 1,
"content": "测试内容",
"thumbnail": null,
"_id": "5c8dcf3a5fcbf1100c276648",
"title": "是单独发顺丰",
"category": "5c8dbc2ded67612f8837e0db",
"author": "5c8dcd072346ad087cf957be",
"createAt": "2019-03-17T04:29:46.212Z",
"updateAt": "2019-03-17T04:29:46.212Z"
}
]
请求地址 |
请求方式 |
/posts/count |
GET |
{
"postCount": 4,
"draftCount": 11
}
请求地址 |
请求方式 |
/posts/lasted |
GET |
[
{
"state": 1,
"thumbnail": null,
"_id": "5c8dcf415fcbf1100c27664b",
"title": "测试文章",
"category": {
"className": "fa-glass",
"_id": "5c8dbc2ded67612f8837e0db",
"title": "奇趣事",
"createAt": "2019-03-17T03:17:01.733Z"
},
"author": {
"role": "admin",
"avatar": null,
"status": 1,
"_id": "5c8dcd072346ad087cf957be",
"nickName": "coder",
"email": "[email protected]",
"createTime": "2019-03-17T04:28:55.780Z"
},
"createAt": "2019-03-20T04:29:46.212Z",
"updateAt": "2019-03-20T04:29:46.212Z"
}
]
请求地址 |
请求方式 |
/posts/recommend |
GET |
[
{
"meta": {
"views": 0,
"likes": 0,
"comments": 3
},
"state": 1,
"thumbnail": null,
"_id": "5c8dcf3f5fcbf1100c27664a",
"title": "测试文章",
"category": "5c8dbc2ded67612f8837e0db",
"author": "5c8dcd072346ad087cf957be",
"createAt": "2019-03-19T04:29:46.212Z",
"updateAt": "2019-03-19T04:29:46.212Z"
}
]
请求地址 |
请求方式 |
/posts/random |
GET |
[
{
"meta": {
"views": 0,
"likes": 0,
"comments": 0
},
"state": 1,
"content": "测试内容",
"thumbnail": null,
"_id": "5c8dcf3a5fcbf1100c276648",
"title": "是单独发顺丰",
"category": "5c8dbc2ded67612f8837e0db",
"author": "5c8dcd072346ad087cf957be",
"createAt": "2019-03-17T04:29:46.212Z",
"updateAt": "2019-03-17T04:29:46.212Z"
}
]
参数名称 |
是否必选 |
参数说明 |
title |
否 |
文章标题 |
state |
否 |
文章状态 [0 草稿] [1 发布] |
content |
否 |
文章内容 |
category |
否 |
文章所属分类 |
thumbnail |
否 |
文章缩略图 |
{
"meta": {
"views": 0,
"likes": 0,
"comments": 0
},
"state": 1,
"content": "测试内容",
"thumbnail": "\\uploads\\upload_ac37048704b9a9624f15017debe70932.jpg",
"_id": "623d7baa00b63554ddbf9a99",
"title": "测试文章",
"category": "623ad94f2117f699fb85bb6c",
"author": "6231fc8a875361a58cd8691b",
"createAt": "2022-03-25T08:21:00.000Z",
"updateAt": "2022-03-25T08:22:02.600Z"
}
请求地址 |
请求方式 |
/posts/:id |
DELETE |
{
"meta": {
"views": 0,
"likes": 0,
"comments": 0
},
"state": 1,
"content": "测试内容",
"thumbnail": "\\uploads\\upload_ac37048704b9a9624f15017debe70932.jpg",
"_id": "623d7baa00b63554ddbf9a99",
"title": "测试文章",
"category": "623ad94f2117f699fb85bb6c",
"author": "6231fc8a875361a58cd8691b",
"createAt": "2022-03-25T08:21:00.000Z",
"updateAt": "2022-03-25T08:22:02.600Z"
}
请求地址 |
请求方式 |
/posts/fabulous/:id |
POST |
{
"meta": {
"views": 0,
"likes": 4,
"comments": 0
},
"_id": "5c8dcf3a5fcbf1100c276648"
}
请求地址 |
请求方式 |
/posts/search/:key |
GET |
[
{
"meta": {
"views": 0,
"likes": 0,
"comments": 0
},
"state": 1,
"content": "测试内容",
"thumbnail": "\\uploads\\upload_ac37048704b9a9624f15017debe70932.jpg",
"_id": "623d7baa00b63554ddbf9a99",
"title": "测试文章",
"category": "623ad94f2117f699fb85bb6c",
"author": "6231fc8a875361a58cd8691b",
"createAt": "2022-03-25T08:21:00.000Z",
"updateAt": "2022-03-25T08:22:02.600Z"
}
]
参数名称 |
是否必选 |
参数说明 |
content |
是 |
评论内容 |
post |
是 |
评论文章id |
state |
是 |
评论状态 |
{
"state": 0,
"_id": "5c8dee68f4ce931c2c4a0cc3",
"author": "5c8dcd072346ad087cf957be",
"content": "文章很精彩",
"post": "5c8dcf3a5fcbf1100c276648",
"createAt": "2019-03-17T06:51:20.552Z"
}
{
"page": 1,
"size": 10,
"total": 1,
"records": [
{
"state": 1,
"_id": "5c8deda9481a8a3070377305",
"author": {
"role": "admin",
"avatar": null,
"status": 1,
"_id": "5c8dcd072346ad087cf957be",
"nickName": "coder",
"email": "[email protected]",
"createTime": "2019-03-17T04:28:55.780Z"
},
"content": "文章很精彩",
"post": {
"state": 1,
"thumbnail": null,
"_id": "5c8dcf3a5fcbf1100c276648",
"title": "是单独发顺丰",
"category": "5c8dbc2ded67612f8837e0db",
"author": "5c8dcd072346ad087cf957be",
"createAt": "2019-03-17T04:29:46.212Z",
"updateAt": "2019-03-17T04:29:46.212Z"
},
"createAt": "2019-03-17T06:48:09.954Z"
}
],
"pages": 1,
"display": [
1
]
}
请求地址 |
请求方式 |
/comments/:id |
PUT |
参数名称 |
是否必选 |
参数说明 |
state |
是 |
0或1 |
{
"state": 0,
"_id": "5c8deda9481a8a3070377305",
"author": "5c8dcd072346ad087cf957be",
"content": "文章很精彩",
"post": "5c8dcf3a5fcbf1100c276648",
"createAt": "2019-03-17T06:48:09.954Z"
}
请求地址 |
请求方式 |
/comments/count |
GET |
请求地址 |
请求方式 |
/comments/lasted |
GET |
[
{
"state": 0,
"_id": "5c8f2e5f5cd7da32e093c506",
"author": {
"role": "admin",
"avatar": null,
"status": 1,
"_id": "5c8dcd072346ad087cf957be",
"nickName": "coder",
"email": "[email protected]",
"createTime": "2019-03-17T04:28:55.780Z"
},
"content": "万分精彩!!!!",
"post": "5c8dcf3f5fcbf1100c27664a",
"createAt": "2019-03-19T05:36:31.187Z"
}
]
请求地址 |
请求方式 |
/comments/:id |
DELETE |
{
"state": 0,
"_id": "5c8dee68f4ce931c2c4a0cc3",
"author": "5c8dcd072346ad087cf957be",
"content": "文章很精彩",
"post": "5c8dcf3a5fcbf1100c276648",
"createAt": "2019-03-17T06:51:20.552Z"
}
参数名称 |
是否必选 |
参数说明 |
title |
是 |
轮播图标题 |
image |
是 |
轮播图片 |
link |
否 |
图片链接 |
{
"image": "\\uploads\\upload_569f9bc4b04b4979c98a0264fbcff4de.jpg",
"link": "#",
"_id": "5c8e5b459a03f139683b3f53",
"title": "测试标题"
}
[
{
"image": "null",
"link": "#",
"_id": "5c8f1a16b332631efc6fc310",
"title": "轮播图测试标题"
}
]
请求地址 |
请求方式 |
/slides/:id |
DELETE |
{
"image": "/uploads/upload_5c84659382fdbe2cc505ff1c3ef0c134.jpg",
"link": "#",
"_id": "5c8e5e33ba71a93314d3c1eb",
"title": "测试标题"
}
参数名称 |
是否必选 |
参数说明 |
title |
是 |
站点名称 |
comment |
是 |
是否开启评论功能 |
review |
是 |
评论必须经过人工审核 |
logo |
否 |
网站图标 |
{
"logo": null,
"comment": true,
"review": true,
"_id": "5c8ed3e7c7f0701c34a63589",
"title": "测试站点标题"
}
{
"logo": null,
"comment": true,
"review": true,
"_id": "5c8ed3e7c7f0701c34a63589",
"title": "测试站点标题"
}
参数名称 |
是否必选 |
参数说明 |
avatar |
是 |
图片文件 |
[
{
"avatar": "\\uploads\\upload_0f6e4b7e68007f2af2737ed873f6574e.png"
}
]