Updated incoming_request_handlers.js to match database querying
This commit is contained in:
40
.idea/workspace.xml
generated
40
.idea/workspace.xml
generated
@@ -14,7 +14,8 @@
|
|||||||
</configurations>
|
</configurations>
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="00599d5b-7eb5-44da-ad7f-98bf42384c16" name="Changes" comment="Commit war crimes in formal Yugoslavia">
|
<list default="true" id="00599d5b-7eb5-44da-ad7f-98bf42384c16" name="Changes" comment="Crack butt">
|
||||||
|
<change afterPath="$PROJECT_DIR$/code/web/pepper_data_test.js" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/code/web/incoming_request_handlers.js" beforeDir="false" afterPath="$PROJECT_DIR$/code/web/incoming_request_handlers.js" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/code/web/incoming_request_handlers.js" beforeDir="false" afterPath="$PROJECT_DIR$/code/web/incoming_request_handlers.js" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
@@ -49,6 +50,7 @@
|
|||||||
<option value="Interface" />
|
<option value="Interface" />
|
||||||
<option value="Class" />
|
<option value="Class" />
|
||||||
<option value="package.json" />
|
<option value="package.json" />
|
||||||
|
<option value="JavaScript File" />
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
@@ -87,6 +89,7 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent">{
|
<component name="PropertiesComponent">{
|
||||||
"keyToString": {
|
"keyToString": {
|
||||||
|
"Node.js.pepper_data_test.js.executor": "Run",
|
||||||
"git-widget-placeholder": "main",
|
"git-widget-placeholder": "main",
|
||||||
"node.js.detected.package.eslint": "true",
|
"node.js.detected.package.eslint": "true",
|
||||||
"node.js.detected.package.tslint": "true",
|
"node.js.detected.package.tslint": "true",
|
||||||
@@ -103,7 +106,7 @@
|
|||||||
<recent name="$PROJECT_DIR$/code/src/app/src/main/java/com/fitbot" />
|
<recent name="$PROJECT_DIR$/code/src/app/src/main/java/com/fitbot" />
|
||||||
</key>
|
</key>
|
||||||
</component>
|
</component>
|
||||||
<component name="RunManager">
|
<component name="RunManager" selected="Node.js.pepper_data_test.js">
|
||||||
<configuration name="Fitbot" type="AndroidRunConfigurationType" factoryName="Android App">
|
<configuration name="Fitbot" type="AndroidRunConfigurationType" factoryName="Android App">
|
||||||
<option name="DEPLOY" value="true" />
|
<option name="DEPLOY" value="true" />
|
||||||
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
|
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
|
||||||
@@ -160,6 +163,14 @@
|
|||||||
<option name="SKIP_ACTIVITY_VALIDATION" value="false" />
|
<option name="SKIP_ACTIVITY_VALIDATION" value="false" />
|
||||||
<method v="2" />
|
<method v="2" />
|
||||||
</configuration>
|
</configuration>
|
||||||
|
<configuration name="pepper_data_test.js" type="NodeJSConfigurationType" temporary="true" nameIsGenerated="true" path-to-js-file="$PROJECT_DIR$/code/web/pepper_data_test.js" working-dir="$PROJECT_DIR$/code/web">
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
<recent_temporary>
|
||||||
|
<list>
|
||||||
|
<item itemvalue="Node.js.pepper_data_test.js" />
|
||||||
|
</list>
|
||||||
|
</recent_temporary>
|
||||||
</component>
|
</component>
|
||||||
<component name="SharedIndexes">
|
<component name="SharedIndexes">
|
||||||
<attachedChunks>
|
<attachedChunks>
|
||||||
@@ -197,7 +208,9 @@
|
|||||||
<workItem from="1716547378856" duration="243000" />
|
<workItem from="1716547378856" duration="243000" />
|
||||||
<workItem from="1716648462646" duration="8555000" />
|
<workItem from="1716648462646" duration="8555000" />
|
||||||
<workItem from="1716674767699" duration="21000" />
|
<workItem from="1716674767699" duration="21000" />
|
||||||
<workItem from="1716889548355" duration="1275000" />
|
<workItem from="1716889548355" duration="3475000" />
|
||||||
|
<workItem from="1716904079045" duration="2259000" />
|
||||||
|
<workItem from="1716977405893" duration="336000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="Changes">
|
<task id="LOCAL-00001" summary="Changes">
|
||||||
<created>1713528225837</created>
|
<created>1713528225837</created>
|
||||||
@@ -355,7 +368,23 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1716890009616</updated>
|
<updated>1716890009616</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="21" />
|
<task id="LOCAL-00021" summary="Crack butt">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1716890828736</created>
|
||||||
|
<option name="number" value="00021" />
|
||||||
|
<option name="presentableId" value="LOCAL-00021" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1716890828736</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00022" summary="Crack butt">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1716891155110</created>
|
||||||
|
<option name="number" value="00022" />
|
||||||
|
<option name="presentableId" value="LOCAL-00022" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1716891155110</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="23" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
@@ -394,6 +423,7 @@
|
|||||||
<MESSAGE value="updated gay" />
|
<MESSAGE value="updated gay" />
|
||||||
<MESSAGE value="Commit crack cocaine" />
|
<MESSAGE value="Commit crack cocaine" />
|
||||||
<MESSAGE value="Commit war crimes in formal Yugoslavia" />
|
<MESSAGE value="Commit war crimes in formal Yugoslavia" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="Commit war crimes in formal Yugoslavia" />
|
<MESSAGE value="Crack butt" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="Crack butt" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@@ -31,16 +31,19 @@ function handleIncoming(request, response, app, pool)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Send back the data in the right format
|
// Send back the data in the right format
|
||||||
let firstRow = rows[0];
|
let converted = rows.map(row => {
|
||||||
|
return {
|
||||||
|
name: row.Name,
|
||||||
|
description: row.Description,
|
||||||
|
muscleGroup: row.MuscleGroup,
|
||||||
|
imageUrl: row.ImageURL,
|
||||||
|
videoUrl: row.VideoURL
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
response
|
response
|
||||||
.status(200)
|
.status(200)
|
||||||
.send(JSON.stringify({
|
.send(JSON.stringify(converted));
|
||||||
name: firstRow.Name,
|
|
||||||
description: firstRow.Description,
|
|
||||||
muscleGroup: firstRow.MuscleGroup,
|
|
||||||
imageUrl: firstRow.ImageURL,
|
|
||||||
videoUrl: firstRow.VideoURL
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
@@ -64,5 +67,5 @@ function handleIncoming(request, response, app, pool)
|
|||||||
|
|
||||||
// Export the function that registers the incoming request handlers
|
// Export the function that registers the incoming request handlers
|
||||||
module.exports = function(app, pool) {
|
module.exports = function(app, pool) {
|
||||||
app.get('/', (req, res) => handleIncoming(req, res, app, pool));
|
app.post('/', (req, res) => handleIncoming(req, res, app, pool));
|
||||||
};
|
};
|
24
code/web/pepper_data_test.js
Normal file
24
code/web/pepper_data_test.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
const address = 'http://145.92.8.135:3445/';
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
rotationX: 1,
|
||||||
|
rotationY: .4,
|
||||||
|
rotationZ: .1,
|
||||||
|
accelerationX: 1,
|
||||||
|
accelerationY: 2,
|
||||||
|
accelerationZ: 4,
|
||||||
|
deviceId: 1,
|
||||||
|
type: 'data'
|
||||||
|
};
|
||||||
|
|
||||||
|
for ( let i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
setTimeout(() => {
|
||||||
|
console.log("Sending data");
|
||||||
|
fetch(address, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify(data)
|
||||||
|
});
|
||||||
|
}, i * 1000);
|
||||||
|
}
|
Reference in New Issue
Block a user