{"id":13564184,"url":"https://github.com/littlematch0123/blog-api","last_synced_at":"2025-04-03T21:30:29.935Z","repository":{"id":172172742,"uuid":"121025295","full_name":"littlematch0123/blog-api","owner":"littlematch0123","description":"使用express和mongodb开发一套使用RESTful架构的博客系统增删改查API","archived":false,"fork":false,"pushed_at":"2018-06-26T09:44:53.000Z","size":31,"stargazers_count":9,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-04T17:47:10.079Z","etag":null,"topics":["express","mongodb","mongoose","node-js","restful"],"latest_commit_sha":null,"homepage":"https://api.xiaohuochai.cc/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/littlematch0123.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-02-10T15:04:35.000Z","updated_at":"2023-01-10T16:02:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"d4cbc566-4069-40c3-bde8-4f815960e8b0","html_url":"https://github.com/littlematch0123/blog-api","commit_stats":null,"previous_names":["littlematch0123/blog-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/littlematch0123%2Fblog-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/littlematch0123%2Fblog-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/littlematch0123%2Fblog-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/littlematch0123%2Fblog-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/littlematch0123","download_url":"https://codeload.github.com/littlematch0123/blog-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247082819,"owners_count":20880724,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["express","mongodb","mongoose","node-js","restful"],"created_at":"2024-08-01T13:01:27.702Z","updated_at":"2025-04-03T21:30:29.650Z","avatar_url":"https://github.com/littlematch0123.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# 项目说明\n\n\u0026emsp;\u0026emsp;该项目是使用 express框架 和 mongodb数据库 开发的一套使用 RESTful 架构的博客系统API\n\n【域名】\n\n\u0026emsp;\u0026emsp;api.xiaohuochai.cc \n  \n\n【功能模块】\n\n\u0026emsp;\u0026emsp;功能包括认证、用户、类别、文章、评论、点赞和上传图片到七牛\n\n\u0026emsp;\u0026emsp;1、认证(apis/auth)：手机号注册、用户名密码登录、手机验证码登录\n\n\u0026emsp;\u0026emsp;2、用户(apis/user)：查询所有用户信息、查询当前用户信息、更新当前用户信息\n\n\u0026emsp;\u0026emsp;3、类别(apis/category): 加载所有类别、新增类别、更新类别、删除类别\n\n\u0026emsp;\u0026emsp;4、文章(apis/post): 加载所有文章、加载当前文章、新增文章、更新文章、删除文章\n\n\u0026emsp;\u0026emsp;5、评论(apis/comment): 加载所有评论、增加评论、更新评论、删除评论\n\n\u0026emsp;\u0026emsp;6、点赞(apis/like): 加载所有点赞、增加点赞、取消点赞\n\n\u0026emsp;\u0026emsp;7、七牛(apis/qiniu): 获取七牛uploadToken\n\n【项目亮点】\n\n\u0026emsp;\u0026emsp;1、API遵循RESTful设计规范\n\n\u0026emsp;\u0026emsp;2、用户认证接口实现基于JWT技术\n\n\u0026emsp;\u0026emsp;3、使用七牛云作为图床CDN\n\n\u0026emsp;\u0026emsp;4、使用阿里云的短信服务实现验证码功能\n\n【RESTful规范设计】\n\n\u0026emsp;\u0026emsp;以文章操作为例\n\n```\nGET /posts：列出所有文章\nPOST /posts：新建一个文章\nGET /posts/:id：获取某个指定文章的信息\nPUT /posts/:id：更新某个指定文章的信息（提供该文章的全部信息）\nDELETE /posts/:id：删除某个文章（提供该文章的全部信息）\nGET /posts/:id/comments：列出某个指定文章的所有评论\nDELETE /posts/:id/comments/:id：删除某个指定文章的指定评论\n```\n\n【HTTP状态码】\n\n\u0026emsp;\u0026emsp;项目中使用到的HTTP状态码\n\n```\n200 请求成功【GET】\n201 创建或修改或删除成功【POST/PUT/DELETE】\n400 参数错误\n401 未登录【令牌、用户名、密码错误】\n403 禁止访问【权限不足】\n404 资源未找到\n500 服务器错误\n```\n\n【自定义状态码code】\n\n\u0026emsp;\u0026emsp;项目中使用到的自定义状态码\n\n```\n0 成功\n1 自定义失败\n2 系统失败\n3 认证失败\n4 权限不足\n```\n【返回结构】\n\n\u0026emsp;\u0026emsp;API返回结构设计如下，包括code、message、result或err\n```\ncode 自定义状态码\nmessage 说明信息\nresult 成功时的结果\nerr 失败时返回的结果\n```\n\n\u0026emsp;\u0026emsp;0、成功\n```\n{\n  code: 0\n  message: '',\n  result: {}\n}\n```\n\u0026emsp;\u0026emsp;1、自定义失败\n```\n{\n  code: 1\n  message: '自定义文字'\n}\n```\n\u0026emsp;\u0026emsp;2、系统失败\n```\n{\n  code: 2,\n  message: err.message,\n  err: {}\n}\n```\n\u0026emsp;\u0026emsp;3、认证失败\n```\n{\n  code: 3\n  message: '认证失败'\n}\n```\n\u0026emsp;\u0026emsp;4、权限不足\n```\n{\n  code: 4\n  message: '权限不足'\n}\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flittlematch0123%2Fblog-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flittlematch0123%2Fblog-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flittlematch0123%2Fblog-api/lists"}