Skip to content

Instantly share code, notes, and snippets.

@Charpell
Created May 16, 2018 10:38
Show Gist options
  • Save Charpell/0cb0cffd3686e32843f9a9d6367e459e to your computer and use it in GitHub Desktop.
Save Charpell/0cb0cffd3686e32843f9a9d6367e459e to your computer and use it in GitHub Desktop.
exports.delete = functions.https.onRequest((req, res) => {
return cors(req, res, () => {
if(req.method !== 'DELETE') {
return res.status(500).json({
message: 'Not allowed'
})
}
const id = req.query.id
admin.database().ref(`/items/${id}`).remove()
getItemsFromDatabase(res)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment