Created
February 9, 2010 13:18
-
-
Save kurokikaze/299189 to your computer and use it in GitHub Desktop.
This file contains 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
var sys = require("sys"), | |
http = require("http"), | |
tyrant = require("./tyrant/tyrant"); | |
http.createServer(function (request, response) { | |
response.sendHeader(200, {"Content-Type": "text/plain"}); | |
tyrant.connect(); | |
tyrant.addListener('connect', function() { | |
var startDate = (new Date()).getTime(); | |
tyrant.search(tyrant.is('type', 'blog'), tyrant.sort('time', 'desc')).addCallback(function(answer) { | |
var endDate = (new Date()).getTime(); | |
response.sendBody("Hello World\nDone in " + ((endDate - startDate) / 1000) + " seconds\n\n" + JSON.stringify(answer)); | |
response.finish(); | |
tyrant.quit(); | |
}); | |
}); | |
}).listen(8000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment