Skip to content
GitLab
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
Mar 09, 2021
by
Patrick
Browse files
update server
parent
d048ed10
Changes
1
Hide whitespace changes
Inline
Side-by-side
server.js
View file @
37a474e1
...
...
@@ -870,4 +870,62 @@ app.get('/TrafficFlow', async (req, res) => {
}
});
\ No newline at end of file
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
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