Skip to content

Instantly share code, notes, and snippets.

@matthieu-D
Created July 8, 2017 17:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthieu-D/3d61caf0a28af60847892342b7599bb8 to your computer and use it in GitHub Desktop.
Save matthieu-D/3d61caf0a28af60847892342b7599bb8 to your computer and use it in GitHub Desktop.
exports.countTasks = functions.https.onRequest((req, res) => {
var db = admin.database();
var ref = db.ref("/tasks");
ref.once("value", function(snapshot) {
var count = snapshot.numChildren();
res.status(200).json({ count: count });
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment