Skip to content

Instantly share code, notes, and snippets.

@haseebpvt
Last active July 18, 2019 08:27
Show Gist options
  • Select an option

  • Save haseebpvt/ab97419d4241750be2a2342b30f75eab to your computer and use it in GitHub Desktop.

Select an option

Save haseebpvt/ab97419d4241750be2a2342b30f75eab to your computer and use it in GitHub Desktop.
Writing to firebase with Node.js
//Install firebase admin
//npm install firebase-admin --save
//Get generated key and place it in the working directory
//Replace line 7 file name with yours
var firebase = require("firebase-admin");
var serviceAccount = require("./service_accountKey.json");
firebase.initializeApp({
credential: firebase.credential.cert(serviceAccount),
databaseURL: "your_database_link_here"
});
firebase.database().ref("sensor").child("sen_1").child("temp").set("Hello");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment