npm install
or yarn install
node app.js
请求路径:http://localhost:3022/users/sendCode 请求方式:POST
参数名 | 参数说明 | 参数示例 | 是否必传 |
---|---|---|---|
phone | 手机号 | 18790254445 | true |
返回结果:
{
"code": "200",
"message": "发送成功",
"verificationCode": 1879
}
请求路径:http://localhost:3022/users/codePhoneLogin 请求方式:POST
参数名 | 参数说明 | 参数示例 | 是否必传 |
---|---|---|---|
phone | 手机号 | 18790254445 | true |
code | 验证码 | 7721 | true |
返回结果:
{
"code": 200,
"message": "登录成功",
"data": {
"id": 1,
"username": "zmm",
"userpic": "https://sf1-ttcdn-tos.pstatp.com/img/user-avatar/05489ead0d0a573504e261a9d24bd352~300x300.image",
"password": "123456",
"phone": "18790254445",
"email": "321300@qq.com",
"status": "1",
"create_time": 1613965193977,
"userinfo": [
{
"age": {
"type": "Buffer",
"data": [50, 48]
},
"sex": "1",
"job": "前端工程师",
"path": "郑州",
"birthday": "454545"
},
{
"age": {
"type": "Buffer",
"data": [49, 56]
},
"sex": "1",
"job": "未设置",
"path": null,
"birthday": null
}
]
}
}
请求路径:http://localhost:3022/users/login 请求方式:POST
参数名 | 参数说明 | 参数示例 | 是否必传 |
---|---|---|---|
username | 用户名 | 18790254445 | true |
password | 密码 | 123456 | true |
返回结果:
{
"code": 200,
"message": "登录成功",
"data": {
"id": 1,
"username": "zmm",
"userpic": "https://sf1-ttcdn-tos.pstatp.com/img/user-avatar/05489ead0d0a573504e261a9d24bd352~300x300.image",
"password": "123456",
"phone": "18790254445",
"email": "321300@qq.com",
"status": "1",
"create_time": 1613965193977,
"userinfo": {
"age": {
"type": "Buffer",
"data": [50, 48]
},
"sex": "1",
"job": "前端工程师",
"path": "郑州",
"birthday": "454545"
}
}
}
请求路径:http://localhost:3022/users/editUserInfo 请求方式:POST
参数名 | 参数说明 | 参数示例 | 是否必传 |
---|---|---|---|
user_id | 用户 id | 1 | true |
username | 用户名称 | zmm | true |
age | 用户名称 | zmm | true |
sex | 1 | 0 女,1 男 | true |
job | 工作 | 前端工程师 | true |
path | true | ||
birthday | true |
返回结果:
{
"code": 200,
"message": "修改成功",
"data": {
"id": 1,
"username": "zmm",
"userpic": "https://sf1-ttcdn-tos.pstatp.com/img/user-avatar/05489ead0d0a573504e261a9d24bd352~300x300.image",
"password": "123456",
"phone": "18790254445",
"email": "321300@qq.com",
"status": "1",
"create_time": 1613965193977,
"userinfo": {
"age": {
"type": "Buffer",
"data": [50, 48]
},
"sex": "1",
"job": "前端工程师",
"path": "郑州",
"birthday": "454545"
}
}
}
请求路径:http://localhost:3022/users/setPassword 请求方式:POST
参数名 | 参数说明 | 参数示例 | 是否必传 |
---|---|---|---|
user_id | 用户 id | 1 | true |
newpassword | 新密码 | 12345670 | true |
oldpassworld | 旧密码 | 12 | true |
返回结果:
{
"code": 200,
"message": "修改密码成功"
}
请求路径:http://localhost:3022/users/bindEmail 请求方式:POST
参数名 | 参数说明 | 参数示例 | 是否必传 |
---|---|---|---|
user_id | 用户 id | 1 | true |
邮箱 | zmm@qq.com | true |
返回结果:
{
"code": 200,
"message": "邮箱修改成功"
}
请求路径:http://localhost:3022/users/logout 请求方式:POST
返回结果:
{
"code": 200,
"msg": "退出登录"
}
请求路径:http://localhost:3022/follow/followPost 请求方式:POST
参数名 | 参数说明 | 参数示例 | 是否必传 |
---|---|---|---|
user_id | 用户 id | 1 | true |
follow_id | 关注用户 id | 2 | true |
返回结果:
{
"code": 200,
"message": "关注成功"
}
请求路径:http://localhost:3022/users/editUserImage 请求方式:POST
参数名 | 参数说明 | 参数示例 | 是否必传 |
---|---|---|---|
user_id | 用户 id | 1 | true |
file | from-data | true |
返回结果:
{
"code": 200,
"message": "修改成功",
"url": "http://localhost:3022/uploads/Snipaste_2021-02-22_10-31-43.png"
}
请求路径:http://localhost:3022/users/uploadMoreImg 请求方式:POST
参数名 | 参数说明 | 参数示例 | 是否必传 |
---|---|---|---|
user_id | 用户 id | 1 | true |
file | from-data | true |
返回结果:
{
"code": 200,
"message": "上传成功",
"affectedRows": 2
}
请求路径:http://localhost:3022/users/publlish 请求方式:POST
参数名 | 参数说明 | 参数示例 | 是否必传 |
---|---|---|---|
user_id | 用户 id | 1 | true |
title | 视频标题 | true | |
url | 视频路径 | true | |
path | true | ||
isopen | 是否可见(0 可见 1 不可见) | 0 | true |
posting | 封面图 | true |
返回结果:
{
"code": 200,
"msg": "发布成功"
}
请求路径:http://localhost:3022/getCate 请求方式:GET 参数:无
返回结果:
{
"list": [
{
"id": 1,
"category": "javaScript",
"status": "1",
"create_time": "2021-02-20T10:15:41.000Z"
},
{
"id": 2,
"category": "Vue",
"status": "0",
"create_time": "2021-02-20T10:16:21.000Z"
}
]
}
请求路径:http://localhost:3022/getPostCate 请求方式:GET
参数名 | 参数说明 | 参数示例 | 是否必传 |
---|---|---|---|
id | 分类 id | 2 | true |
返回结果:
{
"list": [
{
"id": 1,
"title": "vue组件开发",
"desc": "vue组件开发",
"type": null,
"treate_time": "2021-02-20T10:18:17.000Z",
"cate_id": 2
}
]
}
请求路径:http://localhost:3022/addArticle 请求方式:POST
参数名 | 参数说明 | 参数示例 | 是否必传 |
---|---|---|---|
title | 文章标题 | true | |
descs | 文章排序 | true | |
type | 分类名称 | true | |
cate_id | 分类 id | true | |
content | 文章内容 | true |
返回结果:
{
"code": 200,
"msg": "添加成功"
}
请求路径:http://localhost:3022/editArticle 请求方式:PUT
参数名 | 参数说明 | 参数示例 | 是否必传 |
---|---|---|---|
id | 文章 id | true | |
title | 文章标题 | true | |
descs | 文章排序 | true | |
type | 分类名称 | true | |
cate_id | 分类 id | true | |
content | 文章内容 | true |
返回结果:
{
"code": 200,
"message": "修改成功"
}
请求路径:http://localhost:3022/deleteArticle 请求方式:DELETE
参数名 | 参数说明 | 参数示例 | 是否必传 |
---|---|---|---|
id | 文章 id | true |
返回结果:
{
"code": 200,
"message": "删除成功"
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。