From a91f75d9f6dc5fd93a80f00c830ba00e76327410 Mon Sep 17 00:00:00 2001 From: Bluepr1nt Date: Tue, 28 Mar 2017 15:17:44 +0200 Subject: [PATCH] testing connection --- .idea/modules.xml | 8 ++ .idea/smarthome.iml | 12 ++ .idea/vcs.xml | 6 + .idea/workspace.xml | 249 ++++++++++++++++++++++++++++++++++ mean-app/server/routes/api.js | 16 ++- 5 files changed, 284 insertions(+), 7 deletions(-) create mode 100644 .idea/modules.xml create mode 100644 .idea/smarthome.iml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..542edb6 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/smarthome.iml b/.idea/smarthome.iml new file mode 100644 index 0000000..24643cc --- /dev/null +++ b/.idea/smarthome.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..ad6369b --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,249 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + DEFINITION_ORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + project + + + true + + + + DIRECTORY + + false + + + + + + + + + 1490705283068 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mean-app/server/routes/api.js b/mean-app/server/routes/api.js index 6f0176f..f845adc 100644 --- a/mean-app/server/routes/api.js +++ b/mean-app/server/routes/api.js @@ -5,7 +5,7 @@ var connection = mysql.createConnection({ password : 'asdf1239', database : 'smarthome' }); - + const express = require('express'); @@ -16,12 +16,14 @@ router.post('/telegram', (req, res) => console.log("Telegram received: " + req.body); connection.connect(); - - connection.query('INSTERT INTO telegram (`time`,`data`) VALUES (\'NOW()\', \'' + req.body + '\')', function (error, results, fields) { - if (error) throw error; - - }); - + + //connection.query( + // 'INSTERT INTO telegram (`time`,`data`) VALUES (\'NOW()\', \'' + req.body + '\')', + // function (error, results, fields) { + // if (error) throw error; + + //}); +console.log(body); connection.end(); res.status(200);