摘要:
//1:加载http express框架//2:创建服务器const http = require("http");const express = require("express");var app = express();var server = http.createServer(app);s 阅读全文
posted @ 2017-08-10 15:52
ThisCall
阅读(1392)
评论(0)
推荐(0)
摘要:
const http = require("http");const express = require("express");//3:创建express应用//4:创建服务器var app = express();//Express本质是一个处理请求函数var server = http.crea 阅读全文
posted @ 2017-08-10 15:27
ThisCall
阅读(287)
评论(0)
推荐(0)
摘要:
//1:加载相应的模块 http url fs mysqlconst http = require("http");const url = require("url");const fs = require("fs");const mysql = require("mysql");//2:创建连接池 阅读全文
posted @ 2017-08-10 14:36
ThisCall
阅读(1908)
评论(0)
推荐(0)
摘要:
const mysql = require("mysql");var conn = mysql.createConnection({ host:"127.0.0.1", user:'root', password:'', database:'jd', port:3306});//2:发送sql//c 阅读全文
posted @ 2017-08-10 13:06
ThisCall
阅读(157)
评论(0)
推荐(0)
摘要:
//#使用nodejs编写动态的web服务器//1:加载需要模块 fs http urlconst fs = require("fs");const http = require("http");const url = require("url"); //2:创建web服务器//3:绑定端口var 阅读全文
posted @ 2017-08-10 11:59
ThisCall
阅读(417)
评论(0)
推荐(0)
摘要:
//功能:创建web服务器接收客户请求// http://127.0.0.1:8080/index 准备// http://127.0.0.1:8080/news 准备// public/index.html// public/news.html// public/404.html//1:加载htt 阅读全文
posted @ 2017-08-10 09:58
ThisCall
阅读(1681)
评论(0)
推荐(0)
摘要:
//1:加载http模块 httpconst http = require("http");//2:创建http 服务器var server = http.createServer();//3:为服务器绑定监听端口 8080//端品有效范围: 1023 65535server.listen(8080 阅读全文
posted @ 2017-08-10 09:49
ThisCall
阅读(205)
评论(0)
推荐(0)
摘要:
console.log("1:开始读成取文件内容...");fs.readFile('./public/2.log',function(err,data){ if(err){ console.log("文件读取出现错误"); //console.log(err);错误的话返回code:ENOENT 阅读全文
posted @ 2017-08-10 09:17
ThisCall
阅读(275)
评论(0)
推荐(0)
摘要:
//1:字节 byte//1024b = 1kb [千字节]//1024kb = 1mb [兆字节]//1024mb = 1gb [吉字节]//1024gb = 1tb [梯]//1024tb = 1pb //1:创建大小为1024字节缓冲区var buf1 = Buffer.alloc(1024) 阅读全文
posted @ 2017-08-10 09:02
ThisCall
阅读(199)
评论(0)
推荐(0)
摘要:
const url = require("url");var u = "https://www.jd.com:443/ad/index?uname=qd";//将url解析js对象var obj = url.parse(u);console.log(obj);//true:指定querystring 阅读全文
posted @ 2017-08-10 08:16
ThisCall
阅读(120)
评论(0)
推荐(0)

浙公网安备 33010602011771号