node.js (Port 3000)

サーバープログラム

#! /usr/bin/nodejs

var fs = require ('fs');
var http = require ('http');
var url = require ('url');

var server = http.createServer(
	function(request, response) {
response.writeHead(200, {'Content-Type': 'text/html'});
response.write('Good  Morning!!');
var who = url.parse (decodeURI(request.url),true).query.who;
response.write(who);
response.end();
}).listen(3000);

console.log('server running port at 3000');

クライアント
http://localhost:3000/?who=John


Return

Jul/09/2014 AM 08:15