node.js http模块和fs模块上机实验·

  • httpserver
const httpserver = require('http');
var server = httpserver.createServer(function (req,res) {
    console.log(req.url);
    res.write("there is a game of love");
    res.end();
});
server.listen(8090);
  • fs模块
const myfs = require('fs');
//myfs.readAsText('E:\新建文件夹\月关\步步生莲\317464.html');
myfs.readFile('E:\新建文件夹\月关\步步生莲\317464.html','utf-8',(err,data)=>{
console.log(data);
});
原文地址:https://www.cnblogs.com/saintdingspage/p/11023907.html