Skip to content

Instantly share code, notes, and snippets.

@figital
Created August 5, 2011 00:08
Show Gist options
  • Save figital/1126635 to your computer and use it in GitHub Desktop.
Save figital/1126635 to your computer and use it in GitHub Desktop.
This is included in the README.markdown for github.com/figital/cfdump.js
// cfdump.js demo
var http = require('http');
var dump = require('cfdump').dump;
var port = 1337;
var host = "localhost";
var defaultMimeType = "text/html";
function listener(request, response) {
test = {
port : port,
host : host,
listener : listener
}
console.log('BEGIN ----------------------------');
console.log('URI: ' + request.url);
body = '<h3>Hello World</h3>';
body += 'Dump test object:';
body += dump(test);
response.writeHead(200, {'Content-Type': defaultMimeType});
response.end(body);
console.log('END ------------------------------');
}
http.createServer(listener).listen(port, host);
console.log('Server running at http://' + host + ':' + port);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment