{I+=codeWee;}
[node.js] node.js : parsing GET/POST query Data
var http = require('http');
var url = require('url');
var qs = require('querystring'); // for postQuery data


var app = http.createServer(function(req, res){

	var _url = url.parse(req.url, true);



// GET Query data object
	var getQuery = _url.query; 



// POST Query data object
	var postQuery = null; 
	var body = "";
	req.on('data', function(data){
		body += data;
	})	
	req.on('end', function(){
		postQuery = qs.parse(body);
		console.log("postQuery: ", postQuery);
	});

	...


	// ex)
	var id = getQuery.id;
	var title = postQuery.title;

	...


});
HTML | PHP | C++ | DirectX11 | Javascript | C# | HTML5 | ASP | SQL | General | CSS | Oculus Rift | Unity3d | Virtools SDK | Tip | NSIS | PowerShell | node.js | Web API | RTSP | All
Copyright© 2016 CodeWee.com All rights reserved.