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 ...

Get Full Stack Web Development with Raspberry Pi 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.