21 lines
505 B
JavaScript
21 lines
505 B
JavaScript
|
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);
|
||
|
}
|
||
|
}
|