Corrected bug

This commit is contained in:
Thomas FORGIONE 2015-05-18 16:29:44 +02:00
parent 0321b70eb9
commit a8ce19e8c3
1 changed files with 8 additions and 5 deletions

View File

@ -10,7 +10,6 @@ var app = express();
var bodyParser = require('body-parser') var bodyParser = require('body-parser')
var urls = require('./urls'); var urls = require('./urls');
app.set('view engine', 'jade'); app.set('view engine', 'jade');
app.use(bodyParser.text()); app.use(bodyParser.text());
@ -33,10 +32,14 @@ app.post('/post', function(req, res) {
var user_id = req.body.user_id; var user_id = req.body.user_id;
var arrow_id = req.body.arrow_id; var arrow_id = req.body.arrow_id;
pg.connect(pgc.url, function(err, client, done) { 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) { client.query(
// console.log(err); "INSERT INTO arrowclicked(user_id, arrow_id) VALUES($1,$2);",
}); [user_id, arrow_id],
function(err, result) {
release();
}
);
}); });
res.setHeader('Content-Type', 'text/html'); res.setHeader('Content-Type', 'text/html');