3d-interface/server/posts/arrow-clicked/index.js

22 lines
654 B
JavaScript
Raw Permalink Normal View History

2015-05-19 11:03:53 +02:00
var pg = require('pg');
var secret = require('../../private');
2015-07-03 13:27:05 +02:00
var Log = require('../../lib/NodeLog.js');
2015-05-19 11:03:53 +02:00
module.exports.index = function(req, res) {
pg.connect(secret.url, function(err, client, release) {
client.query(
"INSERT INTO arrowclicked(exp_id, arrow_id, time) VALUES($1,$2, to_timestamp($3));",
2015-09-09 15:18:18 +02:00
[req.session.expId, req.body.arrowId, req.body.time],
2015-05-19 11:03:53 +02:00
function(err, result) {
2015-07-01 11:31:44 +02:00
if (err !== null)
2015-07-09 15:04:55 +02:00
Log.dberror(err + ' arrow-clicked');
2015-05-19 11:03:53 +02:00
release();
}
);
});
res.setHeader('Content-Type', 'text/html');
2015-06-05 14:51:46 +02:00
res.send("");
};