Hi @Mik-A,
The firebase admin SDK doesn’t seem to work with netlify, so I ended up just using the rest api.
I wrote some helper functions here for basic data retrieval and updates.
Here’s an example of how I used it:
const database = require("./path/to/fbUtils");
// get data -- this directly returns the data as an object
const data = await database.get("/collection/doc");
// nested documents work too
const moreData = await database.get("/collection/doc/childcollection/anotherdoc");
// update some data
await database.update("/collection/doc/", {
myData: 23,
timestamp: database.currentTimestamp()
})
// add some data
await database.add("/collection/", {
myData: 23,
timestamp: database.currentTimestamp()
})