web server博客项目

  1. Node.js 从零开发 web server博客项目[项目介绍]
  2. Node.js 从零开发 web server博客项目[接口]
  3. Node.js 从零开发 web server博客项目[数据存储]
  4. Node.js 从零开发 web server博客项目[登录]
  5. Node.js 从零开发 web server博客项目[日志]
  6. Node.js 从零开发 web server博客项目[安全]
  7. Node.js 从零开发 web server博客项目[express重构博客项目]
  8. Node.js 从零开发 web server博客项目[koa2重构博客项目]
  9. Node.js 从零开发 web server博客项目[上线与配置]

项目需求

  • 首页 , 作者主页 , 博客详情页
  • 登录页
  • 管理中心 , 新建页 , 编辑页

技术方案

数据存储

  • 博客

1标题1内容11542512945445张三
2标题2内容21542511215145李四
  • 用户

1zhangsan1234张三
2lisi0000李四

接口设计

获取博客列表/api/blog/listgetauthor作者, keyword 搜索关键字参数为空的话, 则不进行查询过滤
获取一篇博客的内容/api/blog/detailgetid
新增一篇博客/api/blog/newpostpost中有新增的信息
更新一篇博客/api/blog/updatepostidpostData 中有更新的内容
删除一篇博客/api/blog/delpostid
登录/api/user/loginpostpostData 中有用户名和密码

开发接口(不用任何框架)

  • nodejs 处理 http 请求

  • 搭建开发环境

  • 开发接口(暂不连接数据库, 暂不考虑登录)

postman json文件

{
"id": "9b059257-accf-6ced-b372-c8b2c1a593bf",
"name": "Node.js 从零开发 web server博客项目 前端晋升全栈工程师必备",
"description": "",
"order": [
"53fadbd2-4bf8-d99c-c4bc-2bad9a9acc4a",
"e9955442-b3a0-270c-5e01-a5a6a3c91e60",
"b13f5e19-ab33-3c9f-63cd-5366015761d6",
"34d0396f-00a4-1691-23ad-ae1de6136fda",
"f24bb99d-dd8c-c181-5d44-9227d7066902",
"e52e4d10-bc5a-685d-77db-bf13871848f6"
],
"folders": [],
"folders_order": [],
"timestamp": 1562430570180,
"owner": "7741397",
"public": false,
"requests": [
{
"id": "34d0396f-00a4-1691-23ad-ae1de6136fda",
"headers": "Content-Type: application/json\n",
"headerData": [
{
"key": "Content-Type",
"value": "application/json",
"description": "",
"enabled": true
}
],
"url": "localhost:9527/api/blog/update?id=7",
"queryParams": [
{
"key": "id",
"value": "7",
"equals": true,
"description": "",
"enabled": true
}
],
"preRequestScript": null,
"pathVariables": {},
"pathVariableData": [],
"method": "POST",
"data": [],
"dataMode": "raw",
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
"time": 1562438278080,
"name": "更新一篇博客",
"description": "",
"collectionId": "9b059257-accf-6ced-b372-c8b2c1a593bf",
"responses": [],
"rawModeData": "{\n\t\"title\": \"文章c\",\n\t\"content\": \"内容c\"\n}"
},
{
"id": "53fadbd2-4bf8-d99c-c4bc-2bad9a9acc4a",
"headers": "",
"headerData": [],
"url": "localhost:9527/api/blog/list?keyword=2",
"queryParams": [
{
"key": "keyword",
"value": "2",
"equals": true,
"description": "",
"enabled": true
}
],
"preRequestScript": null,
"pathVariables": {},
"pathVariableData": [],
"method": "GET",
"data": null,
"dataMode": "params",
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
"time": 1562435228053,
"name": "获取博客列表",
"description": "",
"collectionId": "9b059257-accf-6ced-b372-c8b2c1a593bf",
"responses": []
},
{
"id": "b13f5e19-ab33-3c9f-63cd-5366015761d6",
"headers": "Content-Type: application/json\n",
"headerData": [
{
"key": "Content-Type",
"value": "application/json",
"description": "",
"enabled": true
}
],
"url": "localhost:9527/api/blog/new",
"queryParams": [],
"preRequestScript": null,
"pathVariables": {},
"pathVariableData": [],
"method": "POST",
"data": [],
"dataMode": "raw",
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
"time": 1562438281853,
"name": "新增一篇博客",
"description": "",
"collectionId": "9b059257-accf-6ced-b372-c8b2c1a593bf",
"responses": [],
"rawModeData": "{\n\t\"title\": \"文章B\",\n\t\"content\": \"内容B\"\n}"
},
{
"id": "e52e4d10-bc5a-685d-77db-bf13871848f6",
"headers": "Content-Type: application/json\n",
"headerData": [
{
"key": "Content-Type",
"value": "application/json",
"description": "",
"enabled": true
}
],
"url": "localhost:9527/api/user/login",
"queryParams": [],
"pathVariables": {},
"pathVariableData": [],
"preRequestScript": null,
"method": "POST",
"collectionId": "9b059257-accf-6ced-b372-c8b2c1a593bf",
"data": [],
"dataMode": "raw",
"name": "登录",
"description": "",
"descriptionFormat": "html",
"time": 1562439940328,
"version": 2,
"responses": [],
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
"rawModeData": "{\n\t\"username\": \"zhangsan\",\n\t\"password\": 123\n}"
},
{
"id": "e9955442-b3a0-270c-5e01-a5a6a3c91e60",
"headers": "",
"headerData": [],
"url": "http://localhost:9527/api/blog/detail?id=2",
"queryParams": [
{
"key": "id",
"value": "2",
"equals": true,
"description": "",
"enabled": true
}
],
"pathVariables": {},
"pathVariableData": [],
"preRequestScript": null,
"method": "GET",
"collectionId": "9b059257-accf-6ced-b372-c8b2c1a593bf",
"data": null,
"dataMode": "params",
"name": "获取一篇博客的内容",
"description": "",
"descriptionFormat": "html",
"time": 1562435340139,
"version": 2,
"responses": [],
"tests": null,
"currentHelper": "normal",
"helperAttributes": {}
},
{
"id": "f24bb99d-dd8c-c181-5d44-9227d7066902",
"headers": "Content-Type: application/json\n",
"headerData": [
{
"key": "Content-Type",
"value": "application/json",
"description": "",
"enabled": true
}
],
"url": "localhost:9527/api/blog/del?id=7",
"queryParams": [
{
"key": "id",
"value": "7",
"equals": true,
"description": "",
"enabled": true
}
],
"pathVariables": {},
"pathVariableData": [],
"preRequestScript": null,
"method": "POST",
"collectionId": "9b059257-accf-6ced-b372-c8b2c1a593bf",
"data": [],
"dataMode": "raw",
"name": "删除一篇博客",
"description": "",
"descriptionFormat": "html",
"time": 1562439876334,
"version": 2,
"responses": [],
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
"rawModeData": "{\n\t\"author\": \"zhangsan\"\n}"
}
]
}
04-26 14:56
查看更多