摘要:
// 引入 mongoose 第三方模块 用来操作数据库 const mongoose = require('mongoose'); // 数据库连接 mongoose.connect('mongodb://localhost/playground', { useNewUrlParser: true 阅读全文
摘要:
// 引入 mongoose 第三方模块 用来操作数据库 const mongoose = require('mongoose'); // 数据库连接 mongoose.connect('mongodb://localhost/playground', { useNewUrlParser: true 阅读全文
摘要:
// 更新操作 更新一个 // User.updateOne({ // name: '李四' // }, { name: '李狗蛋', age: 98 }).then(result => console.log(result)) // 更新 所有 // User.updateMany({}, { a 阅读全文
摘要:
// 引入 mongoose 第三方模块 用来操作数据库 const mongoose = require('mongoose'); // 数据库连接 mongoose.connect('mongodb://localhost/playground', { useNewUrlParser: true 阅读全文
摘要:
// 查询所有用户集合中的文档 // User.find().then(result => console.log(result)); // 查询一条 // User.find({ // _id: '5c09f294aeb04b22f8460969' // }).then(result => con 阅读全文
摘要:
导入成功 阅读全文
摘要:
// 引入 mongoose 第三方模块 用来操作数据库 const mongoose = require('mongoose'); // 数据库连接 mongoose.connect('mongodb://localhost/playground', { useNewUrlParser: true 阅读全文
摘要:
加上这两句 不会报错 阅读全文
摘要:
const fs = require('fs'); // fs.readFile('./1.txt', 'utf8', (err, restult1) => { // console.log(restult1); // fs.readFile('./2.txt', 'utf8', (err, res 阅读全文
摘要:
异步API 无法通过返回值拿到 回调函数 阅读全文
摘要:
inpm install mime const mime = require('mime'); 指定返回资源的类型 mime 可以自动区分页面文件 const http = require('http'); const url = require('url'); const app = http.c 阅读全文
摘要:
// 1 引入系统模块 const http = require('http'); const url = require('url'); // 2 创建网站服务 const app = http.createServer(); // 3为网站服务器对象添加请求事件 app.on('request' 阅读全文
摘要:
// 创建服务器模块 const http = require('http'); // app 对象就是网站服务器对象 const app = http.createServer(); // 当有请求的时候 app.on('request', (req, res) => { // 获取请求方式 // 阅读全文
摘要:
阅读全文
摘要:
阅读全文
摘要:
阅读全文
摘要:
阅读全文
摘要:
复制给别人项目,不需要复制 node_modules 文件, 别人收到文件,npm install 就可以 运行项目了 阅读全文
摘要:
// 构建任务 gulp.task('default', ['htmlmin', 'cssmin', 'jsmin', 'copy']); 阅读全文
摘要:
如需卸载:cnpm uninstall gulp -g 如果有安装失败依赖,降低node版本为11 全局安装 gulp:npm install --global gulp 作为项目的开发依赖(devDependencies)安装:npm install --save-dev gulp 这时候会gul 阅读全文