2022-05-20 07:55:08 +02:00
|
|
|
import express from 'express';
|
|
|
|
import { Config } from '../config/config.js';
|
|
|
|
import { Storage } from './storage.js';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export class Web{
|
|
|
|
constructor(){
|
|
|
|
let app = express();
|
|
|
|
|
|
|
|
app.get('/temp',async (req,res)=>{
|
|
|
|
if(Storage.hub==null){
|
|
|
|
res.statusCode(500);
|
|
|
|
res.send("err");
|
|
|
|
}
|
|
|
|
res.json(await Storage.hub.getTemp());
|
|
|
|
})
|
|
|
|
app.use(express.static('static'));
|
|
|
|
app.listen(Config.WEB_SERVER.PORT);
|
2022-05-20 09:54:28 +02:00
|
|
|
this.app = app;
|
2022-05-20 07:55:08 +02:00
|
|
|
}
|
2022-05-20 09:54:28 +02:00
|
|
|
}
|