xdl4

作者: 不停在路上 | 来源:发表于2016-08-10 09:49 被阅读0次

通过nodejs3个模块写一个静态web服务器

Http

const http = require('http');引入
http.creatServer();
var server = new http.Server();
server.listen();
server.on();

File System

const fs = require('fs');
fs.readFile(file,callback);读取文件
fs.readFileSync(file);

URL

var u= url.parse(urlStr);解析url。
u.pathname内容
u.protocol协议
u.hostname主机名
u.port端口
u.host主机名+端口
u.path全部内容

相关文章

  • xdl4

    通过nodejs3个模块写一个静态web服务器 Http File System URL

网友评论

      本文标题:xdl4

      本文链接:https://www.haomeiwen.com/subject/ylzdsttx.html