12 2020 档案

摘要:package.json 文件 { "name": "express07", "version": "1.0.0", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, " 阅读全文
posted @ 2020-12-15 15:55 半遮 阅读(274) 评论(0) 推荐(0) 编辑
摘要:const express = require("express"); const app = express(); const cookieParser = require("cookie-parser"); // 配置 cookiparser 中间件 app.use(cookieParser(" 阅读全文
posted @ 2020-12-13 13:43 半遮 阅读(122) 评论(0) 推荐(0) 编辑
摘要:const express = require("express"); const app = express(); const cookieParser = require("cookie-parser"); // 配置 cookiparser 中间件 app.use(cookieParser(" 阅读全文
posted @ 2020-12-13 13:41 半遮 阅读(169) 评论(0) 推荐(0) 编辑
摘要:/* Express 中间件 : 中间件的功能包括: 执行任何代码; 修改请求和响应对象; 终结请求-响应循环; 调用堆栈中的下一个中间件。 如果 get 、 post 回调函数中,没有 next 参数,那么就匹配上第一个路由,就不会往下匹配了。 如果想往下匹配,那么就需要写 next() 。 中间 阅读全文
posted @ 2020-12-12 12:53 半遮 阅读(157) 评论(0) 推荐(0) 编辑
摘要:// app.js 文件 /* ejs 的使用: express默认就可以集成ejs ,用了express 不需要主动引入ejs; 1、安装 ejs : npm install ejs --save 2、app.set("view engine","ejs") 3、使用: 默认加载的模板引擎的目录是 阅读全文
posted @ 2020-12-11 14:14 半遮 阅读(483) 评论(0) 推荐(0) 编辑
摘要:【操作前提:先连上数据库,show dbs 查看是否存在要备份或还原的数据库,再cmd打开新的命令行工具执行命令】 ① 导出:MongoDB 的数据库导出备份语法:(在新的命令行工具执行)mongodump -h dbhost -d dbname -o dbdirectory 参数说明:-h : M 阅读全文
posted @ 2020-12-02 14:36 半遮 阅读(401) 评论(0) 推荐(0) 编辑
摘要:使用聚合管道可以对集合中的文档进行变换与组合。 命令模板: db.collectionName.aggregate( [ {<stage>,...} ] ) 聚合的表达式: 表达式描述实例 $sum 计算总和。 db.mycol.aggregate([{$group : {_id : "$by_us 阅读全文
posted @ 2020-12-01 22:30 半遮 阅读(287) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示