text: const express = require('express')
  const app = express()
  const port = 5000
  var weatherData
  var telescopeData
  
  app.use('/assets', express.static(__dirname + '/assets'));
  
  app.get('/', (req, res) => {
      res.sendFile('dashboard.html', { root: __dirname + "/html_dashboard" }
      );
  })
  
  app.get('/camera', (req, res) => {
      res.sendFile('camera.html', { root: __dirname + "/html_dashboard" }
      );
  })
  
  app.get('/control', (req, res) => {
      res.sendFile('control.html', { root: __dirname + "/html_dashboard" }
      );
  })
  
  app.get('/ACunit', (req, res) => {
      res.sendFile('ACunit.html', { root: __dirname + "/html_dashboard" }
      );
  })
  
  app.get('/ac_data', (req, res) => {
      // TODO: implement connection to the esp8266
      //  example for sending:
      //  irSend?protocol=18&model=1&mode=0&celsius=1&degrees=23&fanspeed=0&swingv=-1&swingh=-1&light=1&beep=1&econo=1&filter=1&turbo=0&quiet=0&sleep=-1&clean=1&clock=-1&power=1
      console.log("not implemented yet")
      res.send("not implemented yet")
  })
  
  app.get('/weatherData', (req, res) => {
      // send the data to the user
      res.json(weatherData);
  })
  app.get('/telescopeData', (req, res) => {
      // send the data to the user
      res.json(telescopeData);
  })
  app.listen(port, () => {
      console.log(`app listening at http://localhost:${port}`)
  })
  
  //get data from the different server every hour
  setInterval(() => {
      // get weather data from another server
      //example:
      /*
      var xhttp = new XMLHttpRequest();
        xhttp.onreadystatechange = function () {
          if (this.readyState == 4 && this.status == 200) {
            var json = this.responseText;
            data = json;
          }
        };
        xhttp.open("GET", "/data", true); // the another server
        xhttp.send();
        */
  }, 6000 * 60);
  
  //mockup
  telescopeData = {
      "power_status": true,
      "dome_status": true,
      "azimuth": "187",
      "pos_in_sky": "+235,+23"
  }
  weatherData = {
      "temperature": [
          { "Sun Sep 19 2021 18:46:37 GMT+0300 (Israel Daylight Time)": 23.2 },
          { "Sun Sep 19 2021 19:46:37 GMT+0300 (Israel Daylight Time)": 23.2 },
          { "Sun Sep 19 2021 20:46:37 GMT+0300 (Israel Daylight Time)": 25.2 },
          { "Sun Sep 19 2021 21:46:37 GMT+0300 (Israel Daylight Time)": 23.2 },
          { "Sun Sep 19 2021 22:46:37 GMT+0300 (Israel Daylight Time)": 21.2 },
          { "Sun Sep 19 2021 23:46:37 GMT+0300 (Israel Daylight Time)": 26.2 },
          { "Sun Sep 20 2021 00:46:37 GMT+0300 (Israel Daylight Time)": 23.2 }
      ],
      "humidity": [
          { "Sun Sep 19 2021 18:46:37 GMT+0300 (Israel Daylight Time)": 10 },
          { "Sun Sep 19 2021 19:46:37 GMT+0300 (Israel Daylight Time)": 20 },
          { "Sun Sep 19 2021 20:46:37 GMT+0300 (Israel Daylight Time)": 10 },
          { "Sun Sep 19 2021 21:46:37 GMT+0300 (Israel Daylight Time)": 30 },
          { "Sun Sep 19 2021 22:46:37 GMT+0300 (Israel Daylight Time)": 45 },
          { "Sun Sep 19 2021 23:46:37 GMT+0300 (Israel Daylight Time)": 23 },
          { "Sun Sep 19 2021 23:46:37 GMT+0300 (Israel Daylight Time)": 23 },
          { "Sun Sep 19 2021 23:46:37 GMT+0300 (Israel Daylight Time)": 23 },
          { "Sun Sep 19 2021 23:46:37 GMT+0300 (Israel Daylight Time)": 23 },
          { "Sun Sep 19 2021 23:46:37 GMT+0300 (Israel Daylight Time)": 23 },
          { "Sun Sep 19 2021 23:46:37 GMT+0300 (Israel Daylight Time)": 23 },
          { "Sun Sep 20 2021 00:46:37 GMT+0300 (Israel Daylight Time)": 11 }
      ],
      "wind_strength": [
          { "Sun Sep 19 2021 18:46:37 GMT+0300 (Israel Daylight Time)": 10 },
          { "Sun Sep 19 2021 19:46:37 GMT+0300 (Israel Daylight Time)": 20 },
          { "Sun Sep 19 2021 20:46:37 GMT+0300 (Israel Daylight Time)": 10 },
          { "Sun Sep 19 2021 21:46:37 GMT+0300 (Israel Daylight Time)": 30 },
          { "Sun Sep 19 2021 22:46:37 GMT+0300 (Israel Daylight Time)": 45 },
          { "Sun Sep 19 2021 23:46:37 GMT+0300 (Israel Daylight Time)": 23 },
          { "Sun Sep 20 2021 00:46:37 GMT+0300 (Israel Daylight Time)": 11 }
      ],
      "wind_direction": [
          { "Sun Sep 19 2021 18:46:37 GMT+0300 (Israel Daylight Time)": 10 },
          { "Sun Sep 19 2021 19:46:37 GMT+0300 (Israel Daylight Time)": 210 },
          { "Sun Sep 19 2021 20:46:37 GMT+0300 (Israel Daylight Time)": 180 },
          { "Sun Sep 19 2021 21:46:37 GMT+0300 (Israel Daylight Time)": 30 },
          { "Sun Sep 19 2021 22:46:37 GMT+0300 (Israel Daylight Time)": 45 },
          { "Sun Sep 19 2021 23:46:37 GMT+0300 (Israel Daylight Time)": 23 },
          { "Sun Sep 20 2021 00:46:37 GMT+0300 (Israel Daylight Time)": 90 }
      ],
      "rain": [
  
      ],
      "light": [
          { "Sun Sep 19 2021 18:46:37 GMT+0300 (Israel Daylight Time)": 10 },
          { "Sun Sep 19 2021 19:46:37 GMT+0300 (Israel Daylight Time)": 20 },
          { "Sun Sep 19 2021 20:46:37 GMT+0300 (Israel Daylight Time)": 10 },
          { "Sun Sep 19 2021 21:46:37 GMT+0300 (Israel Daylight Time)": 30 },
          { "Sun Sep 19 2021 22:46:37 GMT+0300 (Israel Daylight Time)": 45 },
          { "Sun Sep 19 2021 23:46:37 GMT+0300 (Israel Daylight Time)": 23 },
          { "Sun Sep 20 2021 00:46:37 GMT+0300 (Israel Daylight Time)": 11 }
      ]
  
  }