title: PostgreSQL from NodeJS application
body: <p>I am exploring how best to access a PostgreSQL/PostGIS DB from NodeJS. All I need is simple SQL SELECT queries. Nothing more complex than:</p>
  
  <pre><code>SELECT * 
  FROM portal.catalog AS cat 
  WHERE ST_Intersects(st_geogfromtext('SRID=4326;POLYGON((20 50 ,19 50,19 49,20 50 ))'), cat.gpoly) 
  LIMIT 5000;
  </code></pre>
  
  <p>This will be on a windows7 or windows2008 server, running PostgreSQL 9.2/PostGIS 2.0, The traffic will be pretty light (only a few requests per minute).</p>
  
  <p>Some preliminary research I have done has come up with the following potential directions. But I was interested in hearing from others what is working for them (as an easy implementation).</p>
  
  <ol>
  <li><p><a href="https://github.com/brianc/node-postgres" rel="nofollow noreferrer">https://github.com/brianc/node-postgres</a> (But I am having trouble building it do to firewall issues), Supposed the "pure" solution is better, but I am having issues there also) <a href="https://github.com/brianc/node-postgres-pure" rel="nofollow noreferrer">https://github.com/brianc/node-postgres-pure</a></p></li>
  <li><p><a href="http://www.infoq.com/articles/the_edge_of_net_and_node" rel="nofollow noreferrer">http://www.infoq.com/articles/the_edge_of_net_and_node</a> (And then I guess I would write my own ADO.NET adapter to PostgreSQL)</p></li>
  <li><p>I have also seen references to ODBC for NodeJS (unclear if this is the way to go)</p></li>
  <li><p>Is there something like the SQL adapter for NodeJS? <a href="http://blogs.msdn.com/b/sqlphp/archive/2012/06/08/introducing-the-microsoft-driver-for-node-js-for-sql-server.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/b/sqlphp/archive/2012/06/08/introducing-the-microsoft-driver-for-node-js-for-sql-server.aspx</a></p></li>
  <li><p>There was also a full blown ORM by EntitySpaces (which went bankrupt). Now a defunct opensource project: <a href="https://github.com/EntitySpaces/entityspaces.js" rel="nofollow noreferrer">https://github.com/EntitySpaces/entityspaces.js</a></p></li>
  </ol>