json-api-example
json-api-example copied to clipboard
How to implement `afterSave` hook?
I would like to call some Mongoose Model instance methods after POST/PATCH request succeeds. Right now the only way I see to do this is to put in some kind of hack in beforeSave that schedules a callback later and queries the database using a unique attr, which is obviously not elegant at all. What built-in hooks are there that might be better suited for this?