3d-interface/posts/keyboard-event/index.js

33 lines
943 B
JavaScript
Raw Normal View History

2015-05-19 14:25:35 +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 keyboardevent(exp_id, camera, time)" +
2015-05-20 15:20:59 +02:00
"VALUES($1, ROW(ROW($2,$3,$4),ROW($5,$6,$7)), to_timestamp($8));" ,
2015-05-19 14:25:35 +02:00
[
req.session.exp_id,
req.body.camera.position.x,
req.body.camera.position.y,
req.body.camera.position.z,
2015-05-19 14:25:35 +02:00
req.body.camera.target.x,
req.body.camera.target.y,
req.body.camera.target.z,
req.body.time
2015-05-19 14:25:35 +02:00
],
function(err, result) {
2015-07-01 11:31:44 +02:00
if (err !== null)
console.log("[DBERROR] " + err);
2015-05-19 14:25:35 +02:00
release();
}
);
});
res.setHeader('Content-Type', 'text/html');
res.send("");
};