index.js

    const express = require('express')
const path = require('path')
const app = express()
const getCachedSensorReadings = require('./get-cached-
sensor-readings'
)

app.use('/public', express.static(path.join(__dirname,
'public')))

app.get('/temperature', function (req, res) {
res.json({
value:
getCachedSensorReadings.getTemperature().toFixed(1)
})
})

app.get('/humidity', function (req, res) {
res.json({
value: getCachedSensorReadings.getHumidity()
.toFixed(1)
})
})

app.listen(3000, function () {
console.log('Server listening on port 3000')
})
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.37.38