摘要: 事件驱动程序 创建main.js const events = require('events') // 创建eventEmitter const eventEmitter = new events.EventEmitter() //创建事件处理程序 const connectHandler = f 阅读全文
posted @ 2020-06-08 21:36 dropInInt 阅读(177) 评论(0) 推荐(0) 编辑
摘要: node.js回调函数 新建test.txt:内容如下 我是一个测试 新建main.js 同步示例 1 const fs = require('fs') 2 const data = fs.readFileSync('test.txt') 3 console.log(data.toString()) 阅读全文
posted @ 2020-06-08 15:57 dropInInt 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 安装node.js node.js创建应用 新建server.js 1 const http = require('http') 2 3 http.createServer((Request, Response) => { 4 Response.writeHead(200, { 5 'Content 阅读全文
posted @ 2020-06-08 14:36 dropInInt 阅读(142) 评论(0) 推荐(0) 编辑