diff --git a/server.js b/server.js index 5c6da5f..597f600 100644 --- a/server.js +++ b/server.js @@ -10,7 +10,6 @@ var app = express(); var bodyParser = require('body-parser') var urls = require('./urls'); - app.set('view engine', 'jade'); app.use(bodyParser.text()); @@ -33,10 +32,14 @@ app.post('/post', function(req, res) { var user_id = req.body.user_id; var arrow_id = req.body.arrow_id; - pg.connect(pgc.url, function(err, client, done) { - client.query("INSERT INTO arrowclicked(user_id, arrow_id) VALUES($1,$2);", [user_id, arrow_id], function(err, result) { - // console.log(err); - }); + pg.connect(pgc.url, function(err, client, release) { + client.query( + "INSERT INTO arrowclicked(user_id, arrow_id) VALUES($1,$2);", + [user_id, arrow_id], + function(err, result) { + release(); + } + ); }); res.setHeader('Content-Type', 'text/html');