text: /**
   * New node file
   */
  // https://github.com/brianc/node-postgres/wiki/Example
  var http = require('http');
  var pg = require('pg');
  
  var conString = "postgres://pktippauser:pktippapassword@localhost/postgres";
  
  var server = http.createServer(function(req, res) {
  
    // get a pg client from the connection pool
    pg.connect(conString, function(err, client, done) {
  
      var handleError = function(err) {
        // no error occurred, continue with the request
        if(!err) return false;
        console.log("error : " + err);
        // An error occurred, remove the client from the connection pool.
        // A truthy value passed to done will remove the connection from the pool
        // instead of simply returning it to be reused.
        // In this case, if we have successfully received a client (truthy)
        // then it will be removed from the pool.
        done(client);
        res.writeHead(500, {'content-type': 'text/plain'});
        res.end('An error occurred');
        return true;
      };
  
      // record the visit
      client.query('INSERT INTO visit (date) VALUES ($1)', [new Date()], function(err, result) {
  
        // handle an error from the query
        if(handleError(err)) return;
  
        // get the total number of visits today (including the current visit)
        client.query('SELECT COUNT(date) AS count FROM visit', function(err, result) {
  
          // handle an error from the query
          if(handleError(err)) return;
  
          // return the client to the connection pool for other requests to reuse
          done();
          res.writeHead(200, {'content-type': 'text/plain'});
          res.end('You are visitor number ' + result.rows[0].count);
        });
      });
    });
  });
  
  server.listen(3001);