Created
March 28, 2011 13:48
-
-
Save mlomnicki/890485 to your computer and use it in GitHub Desktop.
node.js simple benchmark
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 pg = require('pg'); | |
var http = require('http'); | |
var conString = "tcp://node:[email protected]/postgres"; | |
var client = new pg.Client(conString); | |
client.connect(); | |
http.createServer(function(req, res) { | |
res.writeHead(200, {'Content-Type': 'text/html'}); | |
client.query("SELECT NOW() as when", function(err, result) { | |
res.write(result.rows[0].when.toString()); | |
res.end(); | |
}); | |
}).listen(1234, 'localhost'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment