Let's discuss what we've written in the preceding code:
- We're calling for the database reference this time over a specific route or a path and listening to the onCreate event and giving it a callback.
- The onWrite function is used because we want a generic event listener to any writing operation that's present in the book event database reference. As such, the event we're going to take should have some powerful metadata, including the event type. This would mean that, based on the event, we can make different and custom behaviors. So, for instance, if we're creating a new entry, we would want to send a confirmation email. But if the event is a delete one, we would instead want to say goodbye to the user and probably convince ...