3d-interface/posts/hovered/index.js

27 lines
742 B
JavaScript
Raw Normal View History

2015-05-21 15:35:40 +02:00
var pg = require('pg');
var secret = require('../../private');
module.exports.index = function(req, res) {
pg.connect(secret.url, function(err, client, release) {
client.query(
"INSERT INTO hovered(exp_id, time, start, arrow_id)" +
2015-05-21 15:35:40 +02:00
"VALUES($1, to_timestamp($2), $3, $4);" ,
[
req.session.exp_id,
2015-05-21 15:35:40 +02:00
req.body.time,
req.body.start ? true : false,
req.body.arrow_id
],
function(err, result) {
2015-07-01 11:31:44 +02:00
if (err !== null)
console.log("[DBERROR] " + err);
2015-05-21 15:35:40 +02:00
release();
}
);
});
res.setHeader('Content-Type', 'text/html');
res.send("");
};