Created
January 21, 2010 18:58
-
-
Save Marak/283072 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http.createServer(function (req, resp) { | |
req.body = ''; | |
req.addListener('data',function(chunk){ | |
req.body += chunk | |
}) | |
req.addListener('end', function(){ | |
var httpParams = {}; | |
req.uri = url.parse(req.url); | |
if(typeof req.uri.query == 'undefined'){req.uri.query = '';} | |
req.uri.params = querystring.parse(req.uri.query); | |
process.mixin(true, httpParams, req.uri.params); | |
process.mixin(true, httpParams, querystring.parse(req.body)); | |
// request processing logic goes here | |
sys.puts('end of http request'); | |
}) | |
}).listen(80); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment