-
-
Save remy/25e892cbc0c951a4614324708acbf656 to your computer and use it in GitHub Desktop.
An example shim for firebase-admin using REST calls under the hood.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
ref(path) { | |
return { | |
async transaction(transform) { | |
const token = await getToken(); | |
const res = await get({ path, token }); | |
return put({ path, token, data: transform(res) }); | |
}, | |
child(key) { | |
return { | |
async set(data) { | |
const token = await getToken(); | |
return put({ path: `${path}/${key}`, data, token }); | |
}, | |
}; | |
}, | |
}; | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment