node.js静态页面服务器
const http = require('http');
const url require('url');
const fs require('fs');
const ip = '192.168.130.2';
const port = 3000;
fs.readFile('/etc/passwd',(err,data) =>{
if(err) throw err;
console.log(data);
});
var f= function(req,res){
var pathname = url.parse(req.url).pathname;
res.write(pathname);
res.end();
}
var f2 = function(){
console.log('server start')
}
网友评论