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);
});

 

posted @ 2019-06-14 16:17  saintdingtheGreat  阅读(180)  评论(0编辑  收藏  举报