1 Star 0 Fork 1

催眠曲/Node

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
server.js 637 Bytes
一键复制 编辑 原始数据 按行查看 历史
Paul Chan 提交于 2019-07-15 17:17 +08:00 . node牛刀小试
var http = require("http");
var url = require("url");
var querystring = require("querystring");
function start(route) {
function onRequest(request, response) {
var pathname = url.parse(request.url).pathname;
console.log("Request for " + pathname + " received.");
route(pathname);
var queryString = url.parse(request.url).query;
console.log(querystring.parse(queryString)["foo"]);
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}
http.createServer(onRequest).listen(88);
console.log("Server has started.");
}
exports.start = start;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/myzgd/Node.git
[email protected]:myzgd/Node.git
myzgd
Node
Node
master

搜索帮助