O'Reilly logo

Full Stack Web Development with Raspberry Pi 3 by Soham Kamani

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing the application process

Since the application process is not a part of the deployed Firebase application that we built in the previous chapter, we will create a new folder for it (for this chapter, it will be named firebase-process).

First, we will be copying over the get-sensor-readings.js module from the previous implementations (shown here for reference):

    var sensor = require('node-dht-sensor')

    const getSensorReadings = (callback) => {
      sensor.read(11, 4, function (err, temperature,     humidity) {
        if (err) {
          return callback(err)
        }
        callback(null, temperature, humidity)
      })
    }

    module.exports = getSensorReadings

Next, we implement the core module:

    /**
     * Import the "get-sensor-readings" module, as well as the firebase admin module ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required