nodejs新建服务器
var http = require('http');
// var optfile = require('./models/optfile');
http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/html; charset=utf-8'});
if(request.url!=="/favicon.ico"){ //清除第2此访问
console.log('访问');
response.write('hello,world');
//optfile.readfile("G:\\www\\nodejs\\one\\models\\aa.txt");
// optfile.readfileSync("G:\\www\\nodejs\\one\\models\\aa.txt");
response.end('hell,man');//不写则没有http协议尾
}
}).listen(8000);
console.log('Server running at http://127.0.0.1:8000/');
转载于:https://www.cnblogs.com/maomi-frontE/p/6084691.html
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
