摘要: 多文件上传: views/admin/user/add.html : <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, i 阅读全文
posted @ 2021-01-05 18:05 半遮 阅读(519) 评论(0) 推荐(0)
摘要: 单文件上传 目录: nav/add.html : <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-sca 阅读全文
posted @ 2021-01-05 12:30 半遮 阅读(164) 评论(0) 推荐(0)
摘要: 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 半遮 阅读(306) 评论(0) 推荐(0)
摘要: const express = require("express"); const app = express(); const cookieParser = require("cookie-parser"); // 配置 cookiparser 中间件 app.use(cookieParser(" 阅读全文
posted @ 2020-12-13 13:43 半遮 阅读(127) 评论(0) 推荐(0)
摘要: const express = require("express"); const app = express(); const cookieParser = require("cookie-parser"); // 配置 cookiparser 中间件 app.use(cookieParser(" 阅读全文
posted @ 2020-12-13 13:41 半遮 阅读(180) 评论(0) 推荐(0)
摘要: /* Express 中间件 : 中间件的功能包括: 执行任何代码; 修改请求和响应对象; 终结请求-响应循环; 调用堆栈中的下一个中间件。 如果 get 、 post 回调函数中,没有 next 参数,那么就匹配上第一个路由,就不会往下匹配了。 如果想往下匹配,那么就需要写 next() 。 中间 阅读全文
posted @ 2020-12-12 12:53 半遮 阅读(176) 评论(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 半遮 阅读(513) 评论(0) 推荐(0)
摘要: 【操作前提:先连上数据库,show dbs 查看是否存在要备份或还原的数据库,再cmd打开新的命令行工具执行命令】 ① 导出:MongoDB 的数据库导出备份语法:(在新的命令行工具执行)mongodump -h dbhost -d dbname -o dbdirectory 参数说明:-h : M 阅读全文
posted @ 2020-12-02 14:36 半遮 阅读(419) 评论(0) 推荐(0)
摘要: 使用聚合管道可以对集合中的文档进行变换与组合。 命令模板: db.collectionName.aggregate( [ {<stage>,...} ] ) 聚合的表达式: 表达式描述实例 $sum 计算总和。 db.mycol.aggregate([{$group : {_id : "$by_us 阅读全文
posted @ 2020-12-01 22:30 半遮 阅读(321) 评论(0) 推荐(0)
摘要: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1 阅读全文
posted @ 2019-08-22 14:33 半遮 阅读(116) 评论(0) 推荐(0)