为何writeHead一用就报错呢
let http = require('http');
let fs = require('fs');
http.createServer((request, response) => {
fs.readFile(`./${request.url}`, (error, data) => {
if (error) {
request.writeHead(404);
request.end('404 not fonund');
} else {
response.writeHead(200);
response.end(data);
}
})
// response.end('the end');
}).listen(8888);