/**
* Created by Administrator on 2017-2-13.
*/
var http = require("http");
var server = http.createServer(function(req,res){
if(req.url === "/"){
res.writeHead(200,{"Content-Type":"text/html;charset=utf-8"});
res.write("<h1 style='color: red;font-size: 50px;text-align: center;'>你好世界</h1>");
res.end("成功!");
}else{
res.writeHead(404,{"Content-Type":"text/html;charset=utf-8"});
res.write("<h1 style='color: red;font-size: 50px;text-align: center;'>404</h1>");
res.end("成功!");
}
});
server.listen(3333);
简单的路由分配
最新推荐文章于 2024-03-09 16:50:23 发布