Skip to content

Instantly share code, notes, and snippets.

@paulbreslin
Last active July 3, 2017 18:20
Show Gist options
  • Save paulbreslin/6627292164f1e228918b7cb5848f93f9 to your computer and use it in GitHub Desktop.
Save paulbreslin/6627292164f1e228918b7cb5848f93f9 to your computer and use it in GitHub Desktop.
// 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