node
BonnieYY
做人,一定要有梦想
展开
-
node最基本的读写文件api
var fs = require(‘fs’)1、写 --同步写 有返回值判断写入是否成功var res = fs.writeFileSync('./www/w1.txt', '第一个文件', 'utf8')console.log(res) //undefinedconsole.log(111)2–异步写fs.writeFile('./www/t1.txt', '111111...原创 2020-03-10 15:45:56 · 201 阅读 · 0 评论 -
最简单的node服务
准备:node环境。1、shell命令: mkdir NodeTest 新建NodeTest文件夹2、cd NodeTest 进入文件夹3、touch app.js 新建app.js文件4、编写app.js文件,先开启服务const http = require('http')const myServer = http.createServer(function(req, res)...原创 2020-03-10 15:38:25 · 864 阅读 · 0 评论