You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use Node (Express) to access my firebase database but every time I try to access I get an error like 1] 22222 segmentation fault (core dumped) node server/app.js or 4302 abort (core dumped) node server/app.js. I can't see what the problem is so I need some enlightenment:
let express = require("express");
let app = express();
var firebase = require("firebase-admin");
require("firebase/database")
const serviceAccount = require("./keys.json");
let config = {
credential: firebase.credential.cert(serviceAccount),
databaseURL: "https://<MY_DB>.firebasedatabase.app",
};
firebase.initializeApp(config);
let db = firebase.database();
app.get("/", (req, res) => {
db.ref().once("value")
.then(function(snapshot) {
console.log(snapshot.val())
})
res.send("Hello World!");
})
app.listen(5000, function () {
console.log("Listened on port 5000!");
});