源码:
var exec = require(“child_process”).exec; function start(response){ console.log(“Request handler ‘start’ was called.”); var body = '<html xmlns="http://www.w3.org/1999/xhtml">'+ '<head>'+ '<meta http-equiv="Content-Type" content="text/html;charset=gb2312"/>'+ '</head>'+ '<body>'+ '<form action="/upload" method="post">'+ '<textarea name="text" rows="20" cols="60"></textarea>'+ '<input type="submit" value="Submit"/>'+ '</form>'+ '</body>'+ '</html>‘; response.writeHead(200,{’Content-Type’:’text/plain’}); response.write(body); response.end(); console.log("’start’ is over!"); } function upload(response){ console.log(“Request handler ‘upload’ war called.”); response.writeHead(200,{’Content-Type’:’text/plain’}); response.write(“Hello Upload!”); response.end(); } exports.start = start; exports.upload = upload;
显示:
![enter image description here][1] [1]: http://cnodejs.org/user_data/images/4f6ace5713664ea2702d8329/4f6ace5713664ea2702d83291333865891964.jpg
大神们,这是咋回事啊,我以为得能自动解析成网页才对啊!求解惑