Last active
July 3, 2017 18:20
-
-
Save paulbreslin/6627292164f1e228918b7cb5848f93f9 to your computer and use it in GitHub Desktop.
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
// API | |
router.post('/words', (req, res) => { | |
const {userId, word} = req.body; | |
db.ref(`words/${userId}`).push({word}, error => { | |
if (error) { | |
res.sendStatus(500); | |
// Log error to external service, e.g. Sentry | |
} else { | |
res.sendStatus(201); | |
} | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment