Skip to content

Instantly share code, notes, and snippets.

@paulbreslin
Last active July 5, 2017 14:25
Show Gist options
  • Save paulbreslin/9a178ef2eb0389266cec4c3e5a15ea33 to your computer and use it in GitHub Desktop.
Save paulbreslin/9a178ef2eb0389266cec4c3e5a15ea33 to your computer and use it in GitHub Desktop.
// API
router.get('/words', async (req, res) => {
const {userId} = req.query;
const wordsSnapshot = await db.ref(`words/${userId}`).once('value');
// BAD
res.send(wordsSnapshot.val())
// GOOD
const response = Object.assign({}, snapshot.val());
res.send(response);
});
@ab95david
Copy link

You have a typo on snapshot.val(), it should be wordsSnapshot.val(). Great article btw! 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment