|
@ -1,5 +1,4 @@ |
|
|
import * as express from 'express'; |
|
|
import * as express from 'express'; |
|
|
import { Database } from '../class/Database'; |
|
|
|
|
|
import { Service } from '../class/Service'; |
|
|
import { Service } from '../class/Service'; |
|
|
|
|
|
|
|
|
export class Routes { |
|
|
export class Routes { |
|
@ -39,9 +38,7 @@ export class Routes { |
|
|
|
|
|
|
|
|
private measurements(): void { |
|
|
private measurements(): void { |
|
|
this.app.get('/measurements', async (req, res) => { |
|
|
this.app.get('/measurements', async (req, res) => { |
|
|
req.on('data', async (data) => { |
|
|
const points = await this.service.database.query('temperature', '1h'); |
|
|
const { filter, timeFrame } = JSON.parse(data); |
|
|
|
|
|
const points = await this.service.database.query('temperature', '5m'); |
|
|
|
|
|
|
|
|
|
|
|
res.header('Content-Type', 'application/json'); |
|
|
res.header('Content-Type', 'application/json'); |
|
|
if (points) { |
|
|
if (points) { |
|
@ -50,7 +47,6 @@ export class Routes { |
|
|
res.send(JSON.stringify({})); |
|
|
res.send(JSON.stringify({})); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private socket(): void { |
|
|
private socket(): void { |
|
|