摘要: /* Koa 的中间件,无论写在前面还是后面,都会先执行中间件的代码, */ /* Koa 路由 get 传值 在 Koa2 中 GET 传值通过request接收,但是接收的方法有两种: query 和 querystring query : 返回的是格式化好的参数对象 querystring : 阅读全文
posted @ 2021-01-23 12:26 半遮 阅读(507) 评论(0) 推荐(0) 编辑
摘要: /* Koa 路由 get 传值 在 Koa2 中 GET 传值通过request接收,但是接收的方法有两种: query 和 querystring query : 返回的是格式化好的参数对象 querystring : 返回的是请求字符串 */ // 引入模块 const Koa = requi 阅读全文
posted @ 2021-01-23 12:24 半遮 阅读(134) 评论(0) 推荐(0) 编辑
摘要: /* Koa 路由 get 传值 在 Koa2 中 GET 传值通过request接收,但是接收的方法有两种: query 和 querystring query : 返回的是格式化好的参数对象 querystring : 返回的是请求字符串 */ // 引入模块 const Koa = requi 阅读全文
posted @ 2021-01-23 12:21 半遮 阅读(103) 评论(0) 推荐(0) 编辑
摘要: koa2 的 中文文档: https://www.itying.com/koa/article-index-id-60.html /* Koa 路由 get 传值 在 Koa2 中 GET 传值通过request接收,但是接收的方法有两种: query 和 querystring query : 返 阅读全文
posted @ 2021-01-22 00:22 半遮 阅读(675) 评论(0) 推荐(0) 编辑
摘要: // async 是让方法变成异步 // await 是等待该代码执行完成后(会阻塞程序执行),再往下执行。 // /** // 普通方法 function getData() { return "这是一个数据"; } console.log(getData()); //返回: 这是一个数据 */ 阅读全文
posted @ 2021-01-20 17:55 半遮 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 参考:https://www.cnblogs.com/LO-ME/p/10883032.html 阅读全文
posted @ 2021-01-20 14:53 半遮 阅读(95) 评论(0) 推荐(0) 编辑
摘要: // ES6 回顾: // 1、模板字符串 /* var name = "张三"; var age = 20; console.log(name + "已经" + age + "岁了!"); //常规的拼接写法 console.log(`${name}已经${age}岁啦`);//ES6的模板字符串 阅读全文
posted @ 2021-01-20 13:27 半遮 阅读(54) 评论(0) 推荐(0) 编辑
摘要: ./model/db.js // 引入mongoose const mongoose = require("mongoose"); //解决index索引引起的弃用提醒:(node:13616) DeprecationWarning: collection.ensureIndex is deprec 阅读全文
posted @ 2021-01-18 19:23 半遮 阅读(148) 评论(0) 推荐(0) 编辑
摘要: ./model/db.js // 引入mongoose const mongoose = require("mongoose"); //解决index索引引起的弃用提醒:(node:13616) DeprecationWarning: collection.ensureIndex is deprec 阅读全文
posted @ 2021-01-18 12:49 半遮 阅读(360) 评论(0) 推荐(0) 编辑
摘要: Model.deleteMany() Model.deleteOne() Model.find() Model.findById() Model.findByIdAndDelete() Model.findByIdAndRemove() Model.findByIdAndUpdate() Model 阅读全文
posted @ 2021-01-17 23:46 半遮 阅读(131) 评论(0) 推荐(0) 编辑