打开github,在github上创建新项目: Repository name: anydoor Descripotion: Tiny NodeJS Static Web server 选择:public 选择:Initialize this repository with a README 添加gitignore文件:Add .gitignore:Node 添加License文件:Add a license: MIT License git clone 该项目地址到本地文件夹 .gitigno…
let http = require('http'); let url = require('url'); let fs = require('fs'); let path = require('path'); http.createServer((req, res) => { if (req.url === '/favicon.ico') return; var pathname = url.parse(req.url).pathname; //默认首页 if (pathname === '/…