Skip to content

Instantly share code, notes, and snippets.

@mlomnicki
Created March 28, 2011 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mlomnicki/890485 to your computer and use it in GitHub Desktop.
Save mlomnicki/890485 to your computer and use it in GitHub Desktop.
node.js simple benchmark
var pg = require('pg');
var http = require('http');
var conString = "tcp://node:node@127.0.0.1/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