摘要: // 引入 mongoose 第三方模块 用来操作数据库 const mongoose = require('mongoose'); // 数据库连接 mongoose.connect('mongodb://localhost/playground', { useNewUrlParser: true 阅读全文
posted @ 2020-06-10 21:41 EricBlog 阅读(101) 评论(0) 推荐(0) 编辑
摘要: // 引入 mongoose 第三方模块 用来操作数据库 const mongoose = require('mongoose'); // 数据库连接 mongoose.connect('mongodb://localhost/playground', { useNewUrlParser: true 阅读全文
posted @ 2020-06-10 20:37 EricBlog 阅读(320) 评论(0) 推荐(0) 编辑
摘要: // 更新操作 更新一个 // User.updateOne({ // name: '李四' // }, { name: '李狗蛋', age: 98 }).then(result => console.log(result)) // 更新 所有 // User.updateMany({}, { a 阅读全文
posted @ 2020-06-10 20:22 EricBlog 阅读(135) 评论(0) 推荐(0) 编辑
摘要: // 引入 mongoose 第三方模块 用来操作数据库 const mongoose = require('mongoose'); // 数据库连接 mongoose.connect('mongodb://localhost/playground', { useNewUrlParser: true 阅读全文
posted @ 2020-06-10 20:13 EricBlog 阅读(120) 评论(0) 推荐(0) 编辑
摘要: // 查询所有用户集合中的文档 // User.find().then(result => console.log(result)); // 查询一条 // User.find({ // _id: '5c09f294aeb04b22f8460969' // }).then(result => con 阅读全文
posted @ 2020-06-10 20:06 EricBlog 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 导入成功 阅读全文
posted @ 2020-06-10 19:39 EricBlog 阅读(131) 评论(0) 推荐(0) 编辑
摘要: // 引入 mongoose 第三方模块 用来操作数据库 const mongoose = require('mongoose'); // 数据库连接 mongoose.connect('mongodb://localhost/playground', { useNewUrlParser: true 阅读全文
posted @ 2020-06-10 19:32 EricBlog 阅读(369) 评论(0) 推荐(0) 编辑
摘要: 加上这两句 不会报错 阅读全文
posted @ 2020-06-10 18:16 EricBlog 阅读(141) 评论(0) 推荐(0) 编辑
摘要: const fs = require('fs'); // fs.readFile('./1.txt', 'utf8', (err, restult1) => { // console.log(restult1); // fs.readFile('./2.txt', 'utf8', (err, res 阅读全文
posted @ 2020-06-10 17:35 EricBlog 阅读(312) 评论(0) 推荐(0) 编辑
摘要: 异步API 无法通过返回值拿到 回调函数 阅读全文
posted @ 2020-06-10 16:12 EricBlog 阅读(961) 评论(0) 推荐(0) 编辑
摘要: inpm install mime const mime = require('mime'); 指定返回资源的类型 mime 可以自动区分页面文件 const http = require('http'); const url = require('url'); const app = http.c 阅读全文
posted @ 2020-06-10 15:17 EricBlog 阅读(371) 评论(0) 推荐(0) 编辑
摘要: // 1 引入系统模块 const http = require('http'); const url = require('url'); // 2 创建网站服务 const app = http.createServer(); // 3为网站服务器对象添加请求事件 app.on('request' 阅读全文
posted @ 2020-06-10 14:33 EricBlog 阅读(96) 评论(0) 推荐(0) 编辑
摘要: // 创建服务器模块 const http = require('http'); // app 对象就是网站服务器对象 const app = http.createServer(); // 当有请求的时候 app.on('request', (req, res) => { // 获取请求方式 // 阅读全文
posted @ 2020-06-10 14:07 EricBlog 阅读(234) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2020-06-10 12:07 EricBlog 阅读(72) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2020-06-10 11:52 EricBlog 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2020-06-10 11:48 EricBlog 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2020-06-10 11:23 EricBlog 阅读(80) 评论(0) 推荐(0) 编辑
摘要: 复制给别人项目,不需要复制 node_modules 文件, 别人收到文件,npm install 就可以 运行项目了 阅读全文
posted @ 2020-06-10 11:01 EricBlog 阅读(598) 评论(0) 推荐(0) 编辑
摘要: // 构建任务 gulp.task('default', ['htmlmin', 'cssmin', 'jsmin', 'copy']); 阅读全文
posted @ 2020-06-10 10:48 EricBlog 阅读(716) 评论(0) 推荐(0) 编辑
摘要: 如需卸载:cnpm uninstall gulp -g 如果有安装失败依赖,降低node版本为11 全局安装 gulp:npm install --global gulp 作为项目的开发依赖(devDependencies)安装:npm install --save-dev gulp 这时候会gul 阅读全文
posted @ 2020-06-10 10:46 EricBlog 阅读(1366) 评论(0) 推荐(0) 编辑