Last active
July 5, 2017 14:25
-
-
Save paulbreslin/9a178ef2eb0389266cec4c3e5a15ea33 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// 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); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You have a typo on
snapshot.val()
, it should bewordsSnapshot.val()
. Great article btw! 😃