Created
September 2, 2011 13:05
-
-
Save booo/1188554 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
pg = require "pg" | |
http = require "http" | |
s = "postgres://postgres:testing@localhost:5432/testing" | |
(http.createServer (req, res) -> | |
pg.connect s, (error, client) -> | |
if error | |
console.log error | |
else | |
client.query "SELECT NOW();", (error, result) -> | |
if error then console.log error | |
else | |
res.writeHead 200 | |
res.write result.rows | |
res.end() | |
).listen 1337 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment