摘要:
// 引入 mongoose 第三方模块 用来操作数据库 const mongoose = require('mongoose'); // 数据库连接 mongoose.connect('mongodb://localhost/playground', { useNewUrlParser: true 阅读全文
posted @ 2020-06-10 19:32
EricBlog
阅读(415)
评论(0)
推荐(0)
摘要:
加上这两句 不会报错 阅读全文
posted @ 2020-06-10 18:16
EricBlog
阅读(145)
评论(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
阅读(318)
评论(0)
推荐(0)
摘要:
异步API 无法通过返回值拿到 回调函数 阅读全文
posted @ 2020-06-10 16:12
EricBlog
阅读(977)
评论(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
阅读(378)
评论(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
阅读(100)
评论(0)
推荐(0)
摘要:
// 创建服务器模块 const http = require('http'); // app 对象就是网站服务器对象 const app = http.createServer(); // 当有请求的时候 app.on('request', (req, res) => { // 获取请求方式 // 阅读全文
posted @ 2020-06-10 14:07
EricBlog
阅读(240)
评论(0)
推荐(0)
摘要:
阅读全文
posted @ 2020-06-10 12:07
EricBlog
阅读(76)
评论(0)
推荐(0)
摘要:
阅读全文
posted @ 2020-06-10 11:52
EricBlog
阅读(153)
评论(0)
推荐(0)
摘要:
阅读全文
posted @ 2020-06-10 11:48
EricBlog
阅读(148)
评论(0)
推荐(0)