exploring the http Object
form.html
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<form action="" method="post">
<input type="text" name="userinput1">
<input type="text" name="userinput2">
<input type="submit">
</form>
</body>
</html>
server.js
var http=require("http");
var querystring=require("querystring");
var util=require("util");
var form=require("fs").readFileSync("form.html");
http.createServer(function(request,response){
if (request.method==="POST") {
var postData="";
request.on('data',function(chunk){
postData+=chunk;
}).on("end",function(){
var postDataObject=querystring.parse(postData);
console.log("User Posted:\n",postData);
response.end("You Posted:\n"+util.inspect(postDataObject));
});
}
if (request.method==="GET") {
response.writeHead(200,{"Content-Type":"text/html"});
response.end(form);
}
}).listen(8080);
运行:hotnode server.js
exploring the http Object的更多相关文章
- [转]第四章 使用OpenCV探测来至运动的结构——Chapter 4:Exploring Structure from Motion Using OpenCV
仅供参考,还未运行程序,理解部分有误,请参考英文原版. 绿色部分非文章内容,是个人理解. 转载请注明:http://blog.csdn.net/raby_gyl/article/details/174 ...
- Exploring the Angular 1.5 .component() method
Angular 1.5 introduced the .component() helper method, which is much simpler than the.directive() de ...
- [翻译.每月一译.每日一段]Exploring Fonts with DirectWrite and Modern C++
Windows with C++ Exploring Fonts with DirectWrite and Modern C++ Kenny Kerr DirectWrite is an incred ...
- Exploring Python Code Objects
Exploring Python Code Objects https://late.am/post/2012/03/26/exploring-python-code-objects.html Ins ...
- Exploring refit, an automatic type-safe REST library for .NET Standard
自动类型安全的.NET标准REST库refit 在SCOTT HANSELMAN 博客上看到一个好东西<Exploring refit, an automatic type-safe RES ...
- [NLP] cs224n-2019 Assignment 1 Exploring Word Vectors
CS224N Assignment 1: Exploring Word Vectors (25 Points)¶ Welcome to CS224n! Before you start, make ...
- ECMAScript 5 新增 Object 接口
对象 构造器 说明 Object getPrototypeOf 返回对象的原型 Object getOwnPropertyDescriptor 返回对象自有属性的属性描述符 Object getOwn ...
- CoreCLR源码探索(一) Object是什么
.Net程序员们每天都在和Object在打交道 如果你问一个.Net程序员什么是Object,他可能会信誓旦旦的告诉你"Object还不简单吗,就是所有类型的基类" 这个答案是对的 ...
- JavaScript Object对象
目录 1. 介绍:阐述 Object 对象. 2. 构造函数:介绍 Object 对象的构造函数. 3. 实例属性:介绍 Object 对象的实例属性:prototype.constructor等等. ...
随机推荐
- 自定义异常时如何定义checked异常和unchecked异常
When defining your own exception type, study the existing exception classes in the Java API and try ...
- 【数据结构】通用的最小堆(最大堆)D-ary Heap
听说有一种最小(大)堆,不限于是完全二叉树,而是完全D叉树,名为D-ary Heap(http://en.wikipedia.org/wiki/D-ary_heap).D可以是1,2,3,4,100, ...
- 读书笔记:<世界是数字的>
世界是数字的?第一次听到这个名词不由的感到惊讶,我有听过地球是海洋的,那世界不应该是人类共同拥有的吗或者也可以说世界是大自然的?为什么世界偏偏是数字的呢?我带着满心的疑问去看了那本<世界是数字的 ...
- Poj 1904 King's Quest 强连通分量
题目链接: http://poj.org/problem?id=1904 题意: 有n个王子和n个公主,王子只能娶自己心仪的公主(一个王子可能会有多个心仪的公主),现已给出一个完美匹配,问每个王子都可 ...
- 设计模式之观察者模式(Observer)
观察者模式原理:当有新的消息产生时发送给观察者,和中介者模式的不同地方是中介者模式强调中介的作用以及中介双方的交互,观察者模式是主动调用观察者成员函数进行消息发送. 代码如下: #include &l ...
- Leetcode#126 Word Ladder II
原题地址 既然是求最短路径,可以考虑动归或广搜.这道题对字典直接进行动归是不现实的,因为字典里的单词非常多.只能选择广搜了. 思路也非常直观,从start或end开始,不断加入所有可到达的单词,直到最 ...
- ffmpeg iOS 编译
编译模拟器版本1 到https://github.com/yuvi/gas-preprocessor下载gas-preprocessor.p并拷贝到/usr/sbin目录中2 下载ffmpeg源码.h ...
- HDAO one error
对normal target设置的background clearcolor 导致 远处天空 通过了 normalRejectTest 所以要对normal target单独设置 不能通过test的 ...
- windows_phone指定时间后执行函数
开发windows phone 应用程序时需要在一段指定的时间后执行某些函数,于是乎想到了通过DispatcherTimer类来实现,再在.Tick后面添加自己想要的事件 DispatcherTime ...
- Nsdate的各种常用操作
// // NVDate.h // // Created by Noval Agung Prayogo on 2/5/14. // Copyright (c) 2014 Noval Agung ...