Skip to content

Instantly share code, notes, and snippets.

@remy

remy/example.js Secret

Created June 1, 2019 16:39
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 remy/25e892cbc0c951a4614324708acbf656 to your computer and use it in GitHub Desktop.
Save remy/25e892cbc0c951a4614324708acbf656 to your computer and use it in GitHub Desktop.
An example shim for firebase-admin using REST calls under the hood.
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