1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| const http = require('http'); const server = http.createServer(); const fs=require("fs");
server.listen(9999, function () { console.log('Server running at http://127.0.0.1:9999/'); });
server.on("request", function (request, response) { response.writeHead(200,{ "Content-Type":"text/html; charset=utf-8" }); fs.readFile("./index.html","utf-8",function(err,data){ if(err) { console.log("index.html loading is failed :"+err); }else{ response.end(data); } }); });
|