Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.