Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Alfakhori
M4labplatform
Commits
37a474e1
Commit
37a474e1
authored
3 years ago
by
Patrick
Browse files
Options
Download
Email Patches
Plain Diff
update server
parent
d048ed10
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
server.js
+59
-1
server.js
with
59 additions
and
1 deletion
+59
-1
server.js
+
59
-
1
View file @
37a474e1
...
@@ -870,4 +870,62 @@ app.get('/TrafficFlow', async (req, res) => {
...
@@ -870,4 +870,62 @@ app.get('/TrafficFlow', async (req, res) => {
}
}
});
});
app
.
post
(
'
/getSTANoiseHist
'
,
async
(
req
,
res
)
=>
{
console
.
log
(
'
command angekommen ////// STANoise/////!
'
)
const
pointData
=
req
.
query
;
// console.log(pointData);
try
{
let
origURL
=
'
http://193.196.138.56/frost-noise-api/v1.1/Datastreams(1)/Observations?$orderby=phenomenonTime%20asc
'
let
STALAeq
=
await
STA_getApiResponse
(
origURL
);
let
STALAeqColl
=
[];
// let origURLmin = 'http://193.196.138.56/frost-noise-api/v1.1/Datastreams(2)/Observations?$orderby=phenomenonTime%20asc'
// let STALAeqmin = await STA_getApiResponse(origURLmin);
// let origURLmax = 'http://193.196.138.56/frost-noise-api/v1.1/Datastreams(3)/Observations?$orderby=phenomenonTime%20asc'
// let STALAeqmax = await STA_getApiResponse(origURLmax);
//eq
for
(
var
i
=
0
;
i
<=
STALAeq
.
value
.
length
-
1
;
i
++
){
var
newNum
=
"
noise
"
;
var
newVal
=
"
LAeq
"
;
STALAeq
.
value
[
i
][
newNum
]
=
newVal
;
STALAeqColl
.
push
(
STALAeq
.
value
[
i
]);
}
do
{
STALAeq
=
await
STA_getApiResponse
(
STALAeq
[
"
@iot.nextLink
"
]);
for
(
var
j
=
0
;
j
<=
STALAeq
.
value
.
length
-
1
;
j
++
){
STALAeqColl
.
push
(
STALAeq
.
value
[
j
]);
}
}
while
(
"
@iot.nextLink
"
in
STALAeq
);
console
.
log
(
STALAeqColl
.
length
)
res
.
json
(
STALAeqColl
);
}
catch
(
err
)
{
console
.
log
(
'
.../loadSetP failed!
\n
'
+
err
);
}
});
function
STA_getApiResponse
(
url
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
// console.log(url)
axios
.
get
(
url
)
.
then
(
function
(
response
)
{
// handle success
// console.log(response.data);
resolve
(
response
.
data
);
})
.
catch
(
function
(
error
)
{
// handle error
// console.log(error);
reject
(
error
);
});
});
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets