Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 1x 1x | const express = require('express');
const fetch = require('node-fetch');
const {data, AnalyzingCurrentTemp} = require("./Utils")
const cors = require('cors');
const app = express();
// returns code coverage information if available
// https://github.com/cypress-io/code-coverage
/* istanbul ignore next */
if (global.__coverage__) {
require('@cypress/code-coverage/middleware/express')(app)
}
const port = 8081;
app.use(cors());
app.get('/api/temperature/:id', (req, res) => {
fetch(
`https://hasydbj5c4gpa2oozfpjpc677a0hxuob.lambda-url.ap-southeast-2.on.aws/sensor/${req.params.id}`
)
.then((response) => response.json())
.then((response) => res.send(AnalyzingCurrentTemp(response)));
});
app.get('/api/productList', (req, res) => {
res.json(data);
});
app.listen(port, () => {
console.log(`SensorTech server at http://localhost:${port}`);
});
|