weather-streamoverlay/controller/express.js

22 lines
530 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);
this.app = app;
}
}