I would use data stream to update automatically my angular material datatable when data get pushed to the database
Here's my router.js
router
  .route("/")
  .get(function (req, res, err) {
    // Get a database reference to our posts
    var db = admin.database();
    var ref = db.ref("/");
    // Attach an asynchronous callback to read the data at our posts reference
    ref.on("value", function (snapshot) {
      var list = [];
      snapshot.forEach(function (elem) {
        list.push(elem.val());
      })
      res.send(list);
    }, function (errorObject) {
      console.log("The read failed: " + errorObject.code);
    });
  });
router
  .route("/")
  .post(function (req, res, err) {
    console.log(req.body);
    // Get a database reference to our posts
    var db = admin.database();
    var ref = db.ref("/");
    // Attach an asynchronous callback to read the data at our posts reference
    ref.push(
      {
        "text": req.body.text
      }
    );
  });
When I run my app I get all my data, then when I try to post data to the database I get this error :
FIREBASE WARNING: Exception was thrown by user callback. Error: Can't set headers after they are sent.
When I use once instead of on I don't get error, but as I need to fetch for new data every update on database, I should use  on to get a data stream.
So how can I use on without getting this error ?